libircbot
library providing a framework for implementing an IRC bot
Loading...
Searching...
No Matches
IBLog Class Reference

Static class providing logging functionality with configurable targets. More...

#include <ircbot/log.h>

Public Member Functions

void IBLog_setFileLogger (FILE *file)
 Set a log writer logging to the specified file handle. More...
 
void IBLog_setSyslogLogger (const char *ident, int facility, int withStderr)
 Set a log writer logging via syslog(). More...
 
void IBLog_setCustomLogger (IBLogWriter writer, void *data)
 Set a custom log writer. More...
 
void IBLog_setMaxLogLevel (IBLogLevel level)
 Set the maximum level for logging. More...
 
void IBLog_setSilent (int silent)
 Silence all logging. More...
 
void IBLog_setAsync (int async)
 Enable async logging. More...
 
void IBLog_msg (IBLogLevel level, const char *message)
 Log a message. More...
 
void IBLog_fmt (IBLogLevel level, const char *format,...)
 Log a message, using printf-like formatting. More...
 

Detailed Description

Static class providing logging functionality with configurable targets.

Member Function Documentation

◆ IBLog_fmt()

void IBLog_fmt ( IBLogLevel  level,
const char *  format,
  ... 
)

Log a message, using printf-like formatting.

Parameters
levelthe log level
formatthe format string
...the arguments for conversions in the format string

◆ IBLog_msg()

void IBLog_msg ( IBLogLevel  level,
const char *  message 
)

Log a message.

Parameters
levelthe log level
messagethe message

◆ IBLog_setAsync()

void IBLog_setAsync ( int  async)

Enable async logging.

If this is set, logging will attempt to offload calling the log writer to the internal thread pool. This is recommended for any log writer that could block. IrcBot_run() will automatically set this if daemonizing was requested. Default: 0

Parameters
async1 to enable async logging, 0 to disable

◆ IBLog_setCustomLogger()

void IBLog_setCustomLogger ( IBLogWriter  writer,
void *  data 
)

Set a custom log writer.

Parameters
writerthe log writer
dataoptional context for the writer

◆ IBLog_setFileLogger()

void IBLog_setFileLogger ( FILE *  file)

Set a log writer logging to the specified file handle.

Parameters
filethe file handle to write to

◆ IBLog_setMaxLogLevel()

void IBLog_setMaxLogLevel ( IBLogLevel  level)

Set the maximum level for logging.

Default: L_INFO.

Parameters
levelthe maximum level

◆ IBLog_setSilent()

void IBLog_setSilent ( int  silent)

Silence all logging.

This is meant to temporarily disable any logging except L_FATAL, for cases when some errors are expected and should be suppressed.

Parameters
silent1 to enable silent mode, 0 to disable

◆ IBLog_setSyslogLogger()

void IBLog_setSyslogLogger ( const char *  ident,
int  facility,
int  withStderr 
)

Set a log writer logging via syslog().

Parameters
identidentification of the logger
facilitysyslog facility to use, see <syslog.h>
withStderrif non-zero, also log to stderr

The documentation for this class was generated from the following file: