User Tools

Site Tools


tools:logger:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:logger:start [2020/11/26 13:03] – [Log Levels] ursgraftools:logger:start [2020/11/26 13:06] (current) – [Default LogWriter] ursgraf
Line 37: Line 37:
  
 <code cpp> <code cpp>
-  StreamLogWriter w(std::cout); +  Logger::setDefaultStreamLogger(std::cout); 
-  Logger::setDefaultWriter(&w)+  Logger log = Logger::getLogger();  // this logger will output onto the default ''LogWriter''.
-  Logger log;  // this logger will output onto the default ''LogWriter''.+
 </code> </code>
 If you forget to assign a default logger, you will not get logging information from components of the library such as the safety system or the executor. If you forget to assign a default logger, you will not get logging information from components of the library such as the safety system or the executor.
Line 46: Line 45:
 Sometimes it can be desirable to have a logger write to the console and write the same content into a file. This is especially helpful on a embedded system where you start an application remotely (e.g. through //ssh//). In such a case you can define a ''StreamLogWriter'' as follows:  Sometimes it can be desirable to have a logger write to the console and write the same content into a file. This is especially helpful on a embedded system where you start an application remotely (e.g. through //ssh//). In such a case you can define a ''StreamLogWriter'' as follows: 
 <code cpp> <code cpp>
-  StreamLogWriter w(std::cout, "/tmp/log");+  Logger::setDefaultStreamLogger(std::cout, "/tmp/log");
 </code> </code>
-lop file will be created at the given location. Its file name will be appended with the current date and time of the creation of the file. That is the creation of the ''StreamLogWriter'' object.+log file will be created at the given location. Its file name will be appended with the current date and time of the creation of the file.
tools/logger/start.1606392217.txt.gz · Last modified: 2020/11/26 13:03 by ursgraf