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.

Committer:
paul_harris77
Date:
Fri Jun 30 16:36:48 2017 +0000
Revision:
2:f1b41864f865
Parent:
1:e1be56fa979a
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.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
paul_harris77 0:23f7bb983ae0 1 //*********************************************************************************************************************
paul_harris77 0:23f7bb983ae0 2 // LOGGER DEFINITIONS - HEADER FILE
paul_harris77 0:23f7bb983ae0 3 // PAUL HARRIS, OCTOBER 2016
paul_harris77 0:23f7bb983ae0 4 // *********************************************************************************************************************
paul_harris77 0:23f7bb983ae0 5
paul_harris77 0:23f7bb983ae0 6 #ifndef LOGGER_DEFS_H
paul_harris77 0:23f7bb983ae0 7 #define LOGGER_DEFS_H
paul_harris77 0:23f7bb983ae0 8
paul_harris77 0:23f7bb983ae0 9 enum eLogLevel{
paul_harris77 0:23f7bb983ae0 10 SUPPRESSED = 0,
paul_harris77 0:23f7bb983ae0 11 ERROR = 1,
paul_harris77 0:23f7bb983ae0 12 WARNING = 2,
paul_harris77 0:23f7bb983ae0 13 NORMAL = 3,
paul_harris77 0:23f7bb983ae0 14 DETAILED = 4,
paul_harris77 0:23f7bb983ae0 15 VERBOSE = 5
paul_harris77 0:23f7bb983ae0 16 };
paul_harris77 0:23f7bb983ae0 17
paul_harris77 0:23f7bb983ae0 18 //Array of char pointers with name of log level enums for printing out (must match enums above)
paul_harris77 0:23f7bb983ae0 19 static const char* sLogLevel[] = {
paul_harris77 0:23f7bb983ae0 20 "SUPPRESSED",
paul_harris77 0:23f7bb983ae0 21 "ERROR",
paul_harris77 0:23f7bb983ae0 22 "WARNING",
paul_harris77 0:23f7bb983ae0 23 "NORMAL",
paul_harris77 0:23f7bb983ae0 24 "DETAILED",
paul_harris77 0:23f7bb983ae0 25 "VERBOSE"
paul_harris77 0:23f7bb983ae0 26 };
paul_harris77 0:23f7bb983ae0 27
paul_harris77 0:23f7bb983ae0 28 enum eLogArea{
paul_harris77 0:23f7bb983ae0 29 LOGGER = 0, //Log area for the logger itself. Required as an absolute minimum.
paul_harris77 0:23f7bb983ae0 30 MAIN = 1,
paul_harris77 2:f1b41864f865 31 SYSTEM_CONTROL = 2,
paul_harris77 1:e1be56fa979a 32 LIDAR_IF = 3,
paul_harris77 1:e1be56fa979a 33 LIDAR_CONTROL = 4,
paul_harris77 1:e1be56fa979a 34 MOTOR_CONTROL = 5,
paul_harris77 1:e1be56fa979a 35 ENCODER = 6,
paul_harris77 1:e1be56fa979a 36 EVENT = 7,
paul_harris77 1:e1be56fa979a 37 OBSERVER = 8
paul_harris77 0:23f7bb983ae0 38 };
paul_harris77 0:23f7bb983ae0 39
paul_harris77 0:23f7bb983ae0 40 //Array of char pointers with name of log area enums for printing out (must match enums above)
paul_harris77 0:23f7bb983ae0 41 static const char* sLogArea[] = {
paul_harris77 0:23f7bb983ae0 42 "LOGGER",
paul_harris77 0:23f7bb983ae0 43 "MAIN",
paul_harris77 2:f1b41864f865 44 "SYSTEM_CONTROL",
paul_harris77 0:23f7bb983ae0 45 "LIDAR_IF",
paul_harris77 1:e1be56fa979a 46 "LIDAR_CONTROL",
paul_harris77 0:23f7bb983ae0 47 "MOTOR_CONTROL",
paul_harris77 1:e1be56fa979a 48 "ENCODER",
paul_harris77 1:e1be56fa979a 49 "EVENT",
paul_harris77 1:e1be56fa979a 50 "OBSERVER"
paul_harris77 0:23f7bb983ae0 51 };
paul_harris77 0:23f7bb983ae0 52
paul_harris77 2:f1b41864f865 53 #endif