General IRI utilities
test_logs.cpp
1 // Copyright (C) 2009-2010 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
2 // Author Sergi Hernandez (shernand@iri.upc.edu)
3 // All rights reserved.
4 //
5 // This file is part of iriutils
6 // iriutils is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Lesser General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 #include <stdio.h>
20 #include <unistd.h>
21 #include <iostream>
22 #include "log.h"
23 
37 int main(int argc,char *argv[])
38 {
39  int int_test=5;
40  double real_test=4.4;
41  std::string string_test("string test");
42  std::vector<int> int_vector_test;
43  std::vector<float> real_vector_test;
44  CLog main_log("log_test");
45 
46  // logging a string
47  main_log.log(string_test);
48  // logging an integer
49  main_log.log(int_test);
50  // logging a real value
51  main_log.log(real_test);
52  // logging an integer vector
53  int_vector_test.push_back(1);
54  int_vector_test.push_back(2);
55  int_vector_test.push_back(3);
56  int_vector_test.push_back(4);
57  int_vector_test.push_back(5);
58  main_log.log_vector(int_vector_test);
59  // logging a real vector
60  real_vector_test.push_back(1.1);
61  real_vector_test.push_back(2.2);
62  real_vector_test.push_back(3.3);
63  real_vector_test.push_back(4.4);
64  real_vector_test.push_back(5.5);
65  real_vector_test.push_back(6.6);
66  main_log.log_vector(real_vector_test);
67 }
Implementation of a log file.
Definition: log.h:50