Files
redAcore/LogCore.h
Charl Wentzel d770d9f6cb 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
2018-11-25 18:24:36 +02:00

48 lines
1.4 KiB
C++

/*
* LogCore.h
*
* Created on: 17 May 2016
* Author: wentzelc
*/
#ifndef REDACORE_LOGCORE_H_
#define REDACORE_LOGCORE_H_
// Standard C/C++ Libraries
#include <stdio.h>
// redA Libraries
#include "DataTreeCore.h"
//---------------------------------------------------------------------------
// Debug options: LogOutput --> First nibble = output format, second nibble = output options
const short
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;
//---------------------------------------------------------------------------
class CLogCore
{
private:
FILE * OutputFile;
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 OutputFormat, const char * Buffer, int Len, const char * Format, ... );
};
//---------------------------------------------------------------------------
#endif /* REDACORE_OGCORE_H_ */