Provides the means to log debug text to various log areas and at various severity levels and send it to a MODSERIAL serial port object for output.
Revision 2:f1b41864f865, committed 2017-06-30
- Comitter:
- paul_harris77
- Date:
- Fri Jun 30 16:36:48 2017 +0000
- Parent:
- 1:e1be56fa979a
- Commit message:
- Updated for compatibility with LidarLitev3 program. Removed extern global declaration of logger object. cSystemControl object now instantiates all required objects and injects cLogger object dependency in to constructor of each object.
Changed in this revision
--- a/cLogger.cpp Sat Jun 10 23:07:20 2017 +0000 +++ b/cLogger.cpp Fri Jun 30 16:36:48 2017 +0000 @@ -18,7 +18,7 @@ //Register required log areas here and set default log levels: registerLogArea(MAIN, NORMAL, "MAIN>>"); - registerLogArea(MAIN_CONTROL, NORMAL, "MAIN_CONTROL>>"); + registerLogArea(SYSTEM_CONTROL, DETAILED, "MAIN_CONTROL>>"); registerLogArea(LIDAR_IF, SUPPRESSED, "LIDAR_IF>>"); registerLogArea(LIDAR_CONTROL, SUPPRESSED, "LIDAR_CONTROL>>"); registerLogArea(MOTOR_CONTROL, SUPPRESSED, "MOTOR_CONTROL>>"); @@ -46,7 +46,7 @@ } } else{ - logger.log(LOGGER, ERROR, "Attempt to register log area \"%s\" failed: Log area already registered!", sLogArea[area]); + log(LOGGER, ERROR, "Attempt to register log area \"%s\" failed: Log area already registered!", sLogArea[area]); } }
--- a/cLogger.h Sat Jun 10 23:07:20 2017 +0000 +++ b/cLogger.h Fri Jun 30 16:36:48 2017 +0000 @@ -78,7 +78,4 @@ //***********End Private member variables************ }; - -//Globally declare a logger object for use in all modules. To be created/defined in main.cpp. -extern cLogger logger; #endif \ No newline at end of file
--- a/logger_defs.h Sat Jun 10 23:07:20 2017 +0000 +++ b/logger_defs.h Fri Jun 30 16:36:48 2017 +0000 @@ -28,7 +28,7 @@ enum eLogArea{ LOGGER = 0, //Log area for the logger itself. Required as an absolute minimum. MAIN = 1, - MAIN_CONTROL = 2, + SYSTEM_CONTROL = 2, LIDAR_IF = 3, LIDAR_CONTROL = 4, MOTOR_CONTROL = 5, @@ -41,7 +41,7 @@ static const char* sLogArea[] = { "LOGGER", "MAIN", - "MAIN_CONTROL", + "SYSTEM_CONTROL", "LIDAR_IF", "LIDAR_CONTROL", "MOTOR_CONTROL", @@ -50,4 +50,4 @@ "OBSERVER" }; -#endif \ No newline at end of file +#endif