54 lines
1.6 KiB
C++
54 lines
1.6 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;
|
|
char * TempBuffer;
|
|
int BufferSize;
|
|
|
|
public:
|
|
CLogCore( FILE * pOutputFile, int pBufferSize = 5000 );
|
|
~CLogCore();
|
|
|
|
// Configuration file
|
|
int ReadLogBufSize( CDataMember * LogConfig );
|
|
EDebugLevel ReadLogLevel( CDataMember * LogConfig );
|
|
int ReadLogOutput( CDataMember * LogConfig );
|
|
|
|
// Log output
|
|
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_ */
|