Important Update:

- LogCore:
  - Implement ReadLogLevel() & ReadLogOutput() methods
    Standardised handling of logging parameters
  - Split Log/Output in config to: Log/Output & Log/Options
  - LogOutput (Show) param: first nibble = format, second nibble = options
  - Replace Format constants (OUT_XXX) with enum ELogOutput
  - Add loRaw format - raw untouched output
  - Replace OUT_CRLF with OUT_NOCRLF - Replace \r\n with "."
  - Improved Binary output method
  - Simplified Log->Output() method
- FunctionCore, ApplicationCore:
  - Replace reading of LogConfig with new methods in LogCore
This commit is contained in:
Charl Wentzel
2018-11-25 18:24:36 +02:00
parent bdff82f9c8
commit d770d9f6cb
5 changed files with 129 additions and 127 deletions

View File

@@ -12,21 +12,18 @@
#include <stdio.h>
// redA Libraries
/* none */
#include "DataTreeCore.h"
//---------------------------------------------------------------------------
// Debug options
// Debug options: LogOutput --> First nibble = output format, second nibble = output options
const short
OUT_COUNT = 1, // Show Length of String
OUT_NORMAL = 2, // Show ASCII output (replace non-printable characters (incl. CR/LF with ".")
OUT_HEX = 4, // Show HEX output
OUT_BIN = 8, // Show BINARY output
OUT_CRLF = 16, // with OUT_NORMAL - do not replace CR/LF with "."
OUT_ASIS = 32; // with OUT_NORMAL - do not replace any non-printable character with "."
OUT_COUNT = 16, // Show Character count
OUT_NOCRLF = 32; // with OUT_NORMAL, show \r\n as "."
//---------------------------------------------------------------------------
typedef enum { loNone = 0, loRaw = 1, loNormal = 2, loHex = 3, loBin = 4 } ELogOutput;
typedef enum { dlNone = 0, dlLow = 1, dlMedium = 2, dlHigh = 3 } EDebugLevel;
//---------------------------------------------------------------------------
@@ -39,8 +36,11 @@ private:
public:
CLogCore( FILE * pOutputFile );
EDebugLevel ReadLogLevel( CDataMember * LogConfig );
int ReadLogOutput( CDataMember * LogConfig );
bool Message( EDebugLevel DebugLevel, EDebugLevel MsgLevel, const char * Format, ... );
bool Output( EDebugLevel DebugLevel, EDebugLevel MsgLevel, const short Show, const char * Buffer, int Len, const char * Format, ... );
bool Output( EDebugLevel DebugLevel, EDebugLevel MsgLevel, const short OutputFormat, const char * Buffer, int Len, const char * Format, ... );
};
//---------------------------------------------------------------------------