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

日志存储 更多...

Public 成员函数

 LoggerStorage ()
 ~LoggerStorage ()
int LoadConfigureFromFile (const char *file_name)
void SaveConfigureToFile ()
int InitConsoleLogger (FILE *output)
 Initialize the logger as a console logger.
int InitFileLogger (const char *filename, long max_file_size=1024 *1024 *10, unsigned char max_backup_files=100)
void UseTimestampUTC (bool is_utc)
 时间模式为UTC标准时间
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,...)
 打印(宽字符版本)
FILE * FileHandler () const
 获得文件句柄
void LoggerFlush ()
 将系统缓存数据立即写入存储设备
int IsEnabled (LogLevel level)
 判断level等级 >= 过滤等级
void SetLevel (LogLevel level)
 设置过滤等级
LogLevel GetLevel (void)
 获得过滤等级
void ShowShortFileName (bool short_name)
 文件路径短名称打印输出使能
void EnableOutputHtmlFormat (bool is_html)
 开启Html格式,输出日志。

Protected 成员函数

int rotateLogFiles ()
void getBackupFileName (const char *base_name, unsigned char index, char *backup_name, size_t size)
long vflog (FILE *fp, LogLevel levelc, const char *timestamp, long thread_id, const char *file, int line, const char *fmt, va_list arg, unsigned long long current_time, unsigned long long *flushed_time)
void parseLine (char *line)

Protected 属性

BeStringA m_config_file_name
UINT m_output_flags
FILE * m_output_console
FILE * m_output_file
BeStringA m_file_name
BeStringA m_fileExt
long m_max_file_size
unsigned char m_max_backup_files
long m_current_file_size
unsigned long long m_flushed_time
unsigned long long m_flush_interval
LogLevel m_log_level
bool m_is_show_short_file_name
bool m_is_html_style
bool m_is_utc_time
AtomicLock m_mutex

详细描述

日志存储

构造及析构函数说明

◆ LoggerStorage()

BUI::LoggerStorage::LoggerStorage ( )

◆ ~LoggerStorage()

BUI::LoggerStorage::~LoggerStorage ( )

成员函数说明

◆ EnableOutputHtmlFormat()

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

开启Html格式,输出日志。

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

◆ FileHandler()

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

获得文件句柄

◆ getBackupFileName()

void BUI::LoggerStorage::getBackupFileName ( const char * base_name,
unsigned char index,
char * backup_name,
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 max_file_size = 1024 *1024 *10,
unsigned char max_backup_files = 100 )
参数
filenameThe name of the output file
max_file_sizeThe maximum number of bytes to write to any one file
max_backup_filesThe maximum number of files for backup
返回
int

◆ IsEnabled()

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

判断level等级 >= 过滤等级

◆ LoadConfigureFromFile()

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

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]file_nameThe 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,
... )

打印(多字节字符版本)

参数
level: 日志等级
print_timestamp: 是否打印时间戳
file: 文件路径
line: 行号
fmt: 格式文本
...: 变长参数

◆ PrintLogW()

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

打印(宽字符版本)

参数
level: 日志等级
print_timestamp: 是否打印时间戳
file: 文件路径
line: 行号
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 short_name)

文件路径短名称打印输出使能

◆ UseTimestampUTC()

void BUI::LoggerStorage::UseTimestampUTC ( bool is_utc)

时间模式为UTC标准时间

参数
is_utcThe name of the output file

◆ vflog()

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

类成员变量说明

◆ m_config_file_name

BeStringA BUI::LoggerStorage::m_config_file_name
protected

◆ m_current_file_size

long BUI::LoggerStorage::m_current_file_size
protected

◆ m_file_name

BeStringA BUI::LoggerStorage::m_file_name
protected

◆ m_fileExt

BeStringA BUI::LoggerStorage::m_fileExt
protected

◆ m_flush_interval

unsigned long long BUI::LoggerStorage::m_flush_interval
protected

◆ m_flushed_time

unsigned long long BUI::LoggerStorage::m_flushed_time
protected

◆ m_is_html_style

bool BUI::LoggerStorage::m_is_html_style
protected

◆ m_is_show_short_file_name

bool BUI::LoggerStorage::m_is_show_short_file_name
protected

◆ m_is_utc_time

bool BUI::LoggerStorage::m_is_utc_time
protected

◆ m_log_level

LogLevel BUI::LoggerStorage::m_log_level
protected

◆ m_max_backup_files

unsigned char BUI::LoggerStorage::m_max_backup_files
protected

◆ m_max_file_size

long BUI::LoggerStorage::m_max_file_size
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 © 2026 · CBlueStudio 版权所有