atobase 3.2.0
ATOMAS atobase
Methods

Functions

ATO_EXPORT void ato_log_setlogfn (ato_logfunction logfunction)
 Override the default logging function. More...
 
ATO_EXPORT ato_eLoglevel ato_log_name2level (const char *c)
 Convert the loglevel name to the enum equivalent. More...
 
ATO_EXPORT const char * ato_log_level2name (ato_eLoglevel level)
 Convert the loglevel enum to the string equivalent. More...
 
ATO_EXPORT const char * ato_log_id (ato_Log *log)
 The unique id of the logger - typically a guid. More...
 
ATO_EXPORT char ato_log_outputtype (ato_Log *log)
 The output type - 'n'one, 'e'rr (stderr), 'out' (stdout), 'p'ath (dir/file) More...
 
ATO_EXPORT const char * ato_log_path (ato_Log *log)
 The full path of the file being logged to if ato_log_outputtype() is path. More...
 
ATO_EXPORT const char * ato_log_upath (ato_Log *log)
 The full 'unique' path, incorporating ato_log_id(), of the file being logged to if ato_log_outputtype() is path. More...
 
ATO_EXPORT size_t ato_log_indentsize (ato_Log *log)
 Amount to indent each level - defaults to 2. More...
 
ATO_EXPORT size_t ato_log_indentlevel (ato_Log *log)
 Indent level as determined by nested ato_log_start()/ato_log_end() calls. More...
 
ATO_EXPORT ato_eLoglevel ato_loglevel (const char *library, const char *module)
 Target loglevel of any log calls within a library/module. More...
 
ATO_EXPORT void ato_setloglevel (const char *library, unsigned long moduleidmask, ato_eLoglevel level)
 Set the loglevel for individual registered libraries/modules. More...
 
ATO_EXPORT bool ato_logfiledump (const char *library, const char *module)
 For modules that dump content to files (to aid debugging), check if file dumping is on or off. More...
 
ATO_EXPORT void ato_setlogfiledump (const char *library, unsigned long moduleidmask, bool filedump)
 For modules that dump content to files (to aid debugging), turn file dumping on or off. More...
 
ATO_EXPORT bool ato_log_msg (ato_Log *log, ato_eLoglevel target, ato_eLoglevel current, const char *library, const char *module, const char *function, const char *format,...)
 Log message content (ATO_LOGSTATE_MSG) if current >= target. More...
 
ATO_EXPORT bool ato_log_start (ato_Log *log, ato_eLoglevel target, ato_eLoglevel current, const char *library, const char *module, const char *function, const char *format,...)
 Log message header (ATO_LOGSTATE_OPEN) if current >= target. More...
 
ATO_EXPORT bool ato_log_end (ato_Log *log, ato_eLoglevel target, ato_eLoglevel current, const char *library, const char *module, const char *function, bool doindentonly, const char *format,...)
 Log message trailer (ATO_LOGSTATE_CLOSE) if current >= target. More...
 

Detailed Description

Function Documentation

◆ ato_log_setlogfn()

ATO_EXPORT void ato_log_setlogfn ( ato_logfunction  logfunction)

Override the default logging function.

Parameters
logfunctionthe custom application log function to use

◆ ato_log_name2level()

ATO_EXPORT ato_eLoglevel ato_log_name2level ( const char *  c)

Convert the loglevel name to the enum equivalent.

Parameters
cthe log level as a string - only first character is significant
Returns
the loglevel enum

◆ ato_log_level2name()

ATO_EXPORT const char * ato_log_level2name ( ato_eLoglevel  level)

Convert the loglevel enum to the string equivalent.

Parameters
levelthe log level enum
Returns
the loglevel string name

◆ ato_log_id()

ATO_EXPORT const char * ato_log_id ( ato_Log log)

The unique id of the logger - typically a guid.

Used to uniquify the logfile name per thread.

Parameters
logthe log object
Returns
logger id

◆ ato_log_outputtype()

ATO_EXPORT char ato_log_outputtype ( ato_Log log)

The output type - 'n'one, 'e'rr (stderr), 'out' (stdout), 'p'ath (dir/file)

Parameters
logthe log object
Returns
output type

◆ ato_log_path()

ATO_EXPORT const char * ato_log_path ( ato_Log log)

The full path of the file being logged to if ato_log_outputtype() is path.

Parameters
logthe log object
Returns
path

◆ ato_log_upath()

ATO_EXPORT const char * ato_log_upath ( ato_Log log)

The full 'unique' path, incorporating ato_log_id(), of the file being logged to if ato_log_outputtype() is path.

This will prefix the id before the file extension, so that logfile.log becomes logfile-id.log.

Parameters
logthe log object
Returns
path incorporating the id

◆ ato_log_indentsize()

ATO_EXPORT size_t ato_log_indentsize ( ato_Log log)

Amount to indent each level - defaults to 2.

Parameters
logthe log object
Returns
Indent size

◆ ato_log_indentlevel()

ATO_EXPORT size_t ato_log_indentlevel ( ato_Log log)

Indent level as determined by nested ato_log_start()/ato_log_end() calls.

Parameters
logthe log object
Returns
Indent level

◆ ato_loglevel()

ATO_EXPORT ato_eLoglevel ato_loglevel ( const char *  library,
const char *  module 
)

Target loglevel of any log calls within a library/module.

Parameters
libraryname of library
modulename of module within library
Returns
Log level

◆ ato_setloglevel()

ATO_EXPORT void ato_setloglevel ( const char *  library,
unsigned long  moduleidmask,
ato_eLoglevel  level 
)

Set the loglevel for individual registered libraries/modules.

e.g.
// Set all registered libraries and modules
ato_setloglevel(NULL, 0, ATO_LOG_WARN);
// Turn off logging in crypto library
ATO_EXPORT void ato_setloglevel(const char *library, unsigned long moduleidmask, ato_eLoglevel level)
Set the loglevel for individual registered libraries/modules.
#define ATO_BASE_LIBRARY
The name of the library.
Definition: types.h:104
#define ATO_BASE_MODULEID_CRYPTO
The crypto module id.
Definition: types.h:136
@ ATO_LOG_WARN
Usually a business level error such as wrong password.
Definition: types.h:80
@ ATO_LOG_OFF
Do not log.
Definition: types.h:77
Parameters
librarythe library name - NULL indicates all. Current known libraries using this SDK are BASE, AKM, STM, CSR. See the relevant #defines e.g. ATO_BASE_LIBRARY
moduleidmaskthe modules each library registers - 0 indicates all. These allow bitwise or-ing
levelthe loglevel to use

◆ ato_logfiledump()

ATO_EXPORT bool ato_logfiledump ( const char *  library,
const char *  module 
)

For modules that dump content to files (to aid debugging), check if file dumping is on or off.

Parameters
libraryname of library
modulename of module within library
Returns
TRUE if file dumping is on.

◆ ato_setlogfiledump()

ATO_EXPORT void ato_setlogfiledump ( const char *  library,
unsigned long  moduleidmask,
bool  filedump 
)

For modules that dump content to files (to aid debugging), turn file dumping on or off.

This has no affect on modules that do not dump files.

Parameters
libraryname of library
moduleidmaskthe modules each library registers - 0 indicates all. These allow bitwise or-ing
filedumpTRUE to turn dumping on.

◆ ato_log_msg()

ATO_EXPORT bool ato_log_msg ( ato_Log log,
ato_eLoglevel  target,
ato_eLoglevel  current,
const char *  library,
const char *  module,
const char *  function,
const char *  format,
  ... 
)

Log message content (ATO_LOGSTATE_MSG) if current >= target.

Parameters
logthe log object
targetthe level the module is set at
currentthe level of the call
librarycall came from
modulecall came from
functioncall came from
formatprintf() format characters
...parameters
Returns
TRUE if logging occurred.

◆ ato_log_start()

ATO_EXPORT bool ato_log_start ( ato_Log log,
ato_eLoglevel  target,
ato_eLoglevel  current,
const char *  library,
const char *  module,
const char *  function,
const char *  format,
  ... 
)

Log message header (ATO_LOGSTATE_OPEN) if current >= target.

Parameters
logthe log object
targetthe level the module is set at
currentthe level of the call
librarycall came from
modulecall came from
functioncall came from
formatprintf() format characters
...parameters
Returns
TRUE if logging occurred.

◆ ato_log_end()

ATO_EXPORT bool ato_log_end ( ato_Log log,
ato_eLoglevel  target,
ato_eLoglevel  current,
const char *  library,
const char *  module,
const char *  function,
bool  doindentonly,
const char *  format,
  ... 
)

Log message trailer (ATO_LOGSTATE_CLOSE) if current >= target.

Parameters
logthe log object
targetthe level the module is set at
currentthe level of the call
librarycall came from
modulecall came from
functioncall came from
doindentonlydon't actually log anything - just adjust the indent level
formatprintf() format characters
...parameters
Returns
TRUE if logging occurred.