cwLog : Added outputCbArg(),outputCb(),formatCbArg(),formatCb().

cwLogPrint() now prints irregardless of the current level.
This commit is contained in:
kevin 2024-05-09 21:54:39 -04:00
parent f8a907f360
commit 5527936024
2 changed files with 31 additions and 2 deletions

View File

@ -112,7 +112,7 @@ cw::rc_t cw::log::msg( handle_t h, unsigned level, const char* function, const c
cw::rc_t cw::log::msg( handle_t h, unsigned level, const char* function, const char* filename, unsigned line, int systemErrorCode, rc_t returnCode, const char* fmt, ... )
{
rc_t rc = returnCode;
if( level >= _handleToPtr(h)->level )
if( level >= _handleToPtr(h)->level || level == kPrint_LogLevel )
{
va_list vl;
va_start(vl,fmt);
@ -146,6 +146,29 @@ unsigned cw::log::flags( handle_t h )
return p->flags;
}
void* cw::log::outputCbArg( handle_t h )
{
log_t* p = _handleToPtr(h);
return p->outCbArg;
}
cw::log::logOutputCbFunc_t cw::log::outputCb( handle_t h )
{
log_t* p = _handleToPtr(h);
return p->outCbFunc;
}
void* cw::log::formatCbArg( handle_t h )
{
log_t* p = _handleToPtr(h);
return p->fmtCbArg;
}
cw::log::logFormatCbFunc_t cw::log::formatCb( handle_t h )
{
log_t* p = _handleToPtr(h);
return p->fmtCbFunc;
}
void cw::log::setOutputCb( handle_t h, logOutputCbFunc_t outFunc, void* outCbArg )
{
@ -214,7 +237,7 @@ void cw::log::defaultFormatter( void* cbArg, logOutputCbFunc_t outFunc, void* ou
// don't print the function,file,line when this is an 'info' msg.
if( level == kInfo_LogLevel )
if( level == kInfo_LogLevel || level == kPrint_LogLevel )
{
loStr = "";
syStr = "";

View File

@ -39,6 +39,12 @@ namespace cw
void setLevel( handle_t h, unsigned level );
unsigned level( handle_t h );
void* outputCbArg( handle_t h );
logOutputCbFunc_t outputCb( handle_t h );
void* formatCbArg( handle_t h );
logFormatCbFunc_t formatCb( handle_t h );
void setOutputCb( handle_t h, logOutputCbFunc_t outFunc, void* outCbArg );
void setFormatCb( handle_t h, logFormatCbFunc_t fmtFunc, void* fmtCbArg );