CBlueUI  
C++ 跨平台跨框架的数据可视化工具
载入中...
搜索中...
未找到
BUI::LoggerStorage类 参考

日志存储 更多...

Public 成员函数

 LoggerStorage ()
 
 ~LoggerStorage ()
 
int LoadConfigureFromFile (const char *filename)
 
void SaveConfigureToFile ()
 
int InitConsoleLogger (FILE *output)
 Initialize the logger as a console logger.
 
int InitFileLogger (const char *filename, long maxFileSize=1024 *1024 *10, unsigned char maxBackupFiles=100)
 
void PrintLogA (LogLevel level, BOOL print_timestamp, const char *file, int line, const char *fmt,...)
 
void PrintLogW (LogLevel level, BOOL print_timestamp, const char *file, int line, const WCHAR *fmt,...)
 
void SetLevel (LogLevel level)
 
LogLevel GetLevel (void)
 
void ShowShortFileName (bool shortName)
 
int IsEnabled (LogLevel level)
 
void LoggerFlush ()
 
void EnableOutputHtmlFormat (bool isHtml)
 开启Html格式,输出日志。
 
FILE * FileHandler () const
 

Protected 成员函数

int rotateLogFiles ()
 
void getBackupFileName (const char *basename, unsigned char index, char *backupname, size_t size)
 
long vflog (FILE *fp, LogLevel levelc, const char *timestamp, long threadID, const char *file, int line, const char *fmt, va_list arg, unsigned long long currentTime, unsigned long long *flushedTime)
 
void parseLine (char *line)
 

Protected 属性

BeStringA m_configfilename
 
UINT m_output_flags
 
FILE * m_output_console
 
FILE * m_output_file
 
BeStringA m_filename
 
BeStringA m_fileExt
 
long m_maxFileSize
 
unsigned char m_maxBackupFiles
 
long m_currentFileSize
 
unsigned long long m_flushedTime
 
unsigned long long m_flushInterval
 
LogLevel m_logLevel
 
bool m_isShowShortFileName
 
bool m_isHtmlStyle
 
AtomicLock m_mutex
 

详细描述

日志存储

构造及析构函数说明

◆ LoggerStorage()

BUI::LoggerStorage::LoggerStorage ( )

◆ ~LoggerStorage()

BUI::LoggerStorage::~LoggerStorage ( )

成员函数说明

◆ EnableOutputHtmlFormat()

void BUI::LoggerStorage::EnableOutputHtmlFormat ( bool  isHtml)

开启Html格式,输出日志。

参数
isHtmltrue:使用html格式;false:普通文本格式

◆ FileHandler()

FILE * BUI::LoggerStorage::FileHandler ( ) const

◆ getBackupFileName()

void BUI::LoggerStorage::getBackupFileName ( const char *  basename,
unsigned char  index,
char *  backupname,
size_t  size 
)
protected

◆ GetLevel()

LogLevel BUI::LoggerStorage::GetLevel ( void  )

◆ InitConsoleLogger()

int BUI::LoggerStorage::InitConsoleLogger ( FILE *  output)

Initialize the logger as a console logger.

参数
outputIf the file pointer is NULL, stdout will be used.
返回
int: Non-zero value upon success or 0 on error

◆ InitFileLogger()

int BUI::LoggerStorage::InitFileLogger ( const char *  filename,
long  maxFileSize = 1024 *1024 *10,
unsigned char  maxBackupFiles = 100 
)
参数
filenameThe name of the output file
maxFileSizeThe maximum number of bytes to write to any one file
maxBackupFilesThe maximum number of files for backup
返回
int

◆ IsEnabled()

int BUI::LoggerStorage::IsEnabled ( LogLevel  level)

◆ LoadConfigureFromFile()

int BUI::LoggerStorage::LoadConfigureFromFile ( const char *  filename)

Configure the logger with a configuration file. If the filename is NULL, return without doing anything.

The following is the configurable key/value list.

key value
level TRACE, DEBUG, INFO, WARN, ERROR or FATAL
autoFlush A flush interval [ms] (off if interval <= 0)
logger console or file
logger.console.output stdout or stderr
logger.file.filename A output filename (max length is 255 bytes)
logger.file.maxFileSize 1-LONG_MAX [bytes] (1 MB if size <= 0)
logger.file.maxBackupFiles 0-65535
logger.format html, txt
参数
[in]filenameThe name of the configuration file
返回
Non-zero value upon success or 0 on error

◆ LoggerFlush()

void BUI::LoggerStorage::LoggerFlush ( )

◆ parseLine()

void BUI::LoggerStorage::parseLine ( char *  line)
protected

◆ PrintLogA()

void BUI::LoggerStorage::PrintLogA ( LogLevel  level,
BOOL  print_timestamp,
const char *  file,
int  line,
const char *  fmt,
  ... 
)

◆ PrintLogW()

void BUI::LoggerStorage::PrintLogW ( LogLevel  level,
BOOL  print_timestamp,
const char *  file,
int  line,
const WCHAR fmt,
  ... 
)

◆ rotateLogFiles()

int BUI::LoggerStorage::rotateLogFiles ( )
protected

◆ SaveConfigureToFile()

void BUI::LoggerStorage::SaveConfigureToFile ( )

◆ SetLevel()

void BUI::LoggerStorage::SetLevel ( LogLevel  level)

◆ ShowShortFileName()

void BUI::LoggerStorage::ShowShortFileName ( bool  shortName)

◆ vflog()

long BUI::LoggerStorage::vflog ( FILE *  fp,
LogLevel  levelc,
const char *  timestamp,
long  threadID,
const char *  file,
int  line,
const char *  fmt,
va_list  arg,
unsigned long long  currentTime,
unsigned long long *  flushedTime 
)
protected

类成员变量说明

◆ m_configfilename

BeStringA BUI::LoggerStorage::m_configfilename
protected

◆ m_currentFileSize

long BUI::LoggerStorage::m_currentFileSize
protected

◆ m_fileExt

BeStringA BUI::LoggerStorage::m_fileExt
protected

◆ m_filename

BeStringA BUI::LoggerStorage::m_filename
protected

◆ m_flushedTime

unsigned long long BUI::LoggerStorage::m_flushedTime
protected

◆ m_flushInterval

unsigned long long BUI::LoggerStorage::m_flushInterval
protected

◆ m_isHtmlStyle

bool BUI::LoggerStorage::m_isHtmlStyle
protected

◆ m_isShowShortFileName

bool BUI::LoggerStorage::m_isShowShortFileName
protected

◆ m_logLevel

LogLevel BUI::LoggerStorage::m_logLevel
protected

◆ m_maxBackupFiles

unsigned char BUI::LoggerStorage::m_maxBackupFiles
protected

◆ m_maxFileSize

long BUI::LoggerStorage::m_maxFileSize
protected

◆ m_mutex

AtomicLock BUI::LoggerStorage::m_mutex
mutableprotected

◆ m_output_console

FILE* BUI::LoggerStorage::m_output_console
protected

◆ m_output_file

FILE* BUI::LoggerStorage::m_output_file
protected

◆ m_output_flags

UINT BUI::LoggerStorage::m_output_flags
protected
鄂公网安备42018502007752 鄂ICP备2024082886
Copyright © 2025 · CBlueStudio 版权所有