Atrinik Server 2.5
Functions | Variables
server/logger.c File Reference
#include <stdarg.h>
#include <global.h>

Go to the source code of this file.

Functions

static void do_print (const char *buf)
void LOG (LogLevel logLevel, const char *format,...)

Variables

static const char *const loglevel_names []
static uint8 loglevel_name_disable = 0

Detailed Description

The LOG system is more than a logger - it works also as error and bug counter system.

Every llevBug LOG will increase the bug counter of the server - if too many errors occur, the server will start an emergency shutdown. This will avoid bug loops or every round LOGs, which will fill the log file quickly.

llevError is always irrecoverable and fatal - if it happens, the server is not stable anymore and it will shutdown immediately.

Definition in file logger.c.


Function Documentation

static void do_print ( const char *  buf) [static]

Put a string to either stderr or logfile.

Parameters:
bufString to put.

Definition at line 61 of file logger.c.

void LOG ( LogLevel  logLevel,
const char *  format,
  ... 
)

Logs a message to stderr, or to file, and/or even to socket. Or discards the message if it is of no importance, and none have asked to hear messages of that logLevel.

See include/logger.h for possible logLevels. Messages with llevSystem and llevError are always printed, regardless of debug mode.

Additionally, llevError message will cause the server to exit.

Parameters:
logLevelLog level of the message
formatFormat specifiers
...Arguments for the format

Definition at line 87 of file logger.c.


Variable Documentation

If 1, will not print one of loglevel_names on the next LOG() call.

Definition at line 56 of file logger.c.

const char* const loglevel_names[] [static]
Initial value:
{
    "[System] ",
    "[Error]  ",
    "[Bug]    ",
    "[Chat]   ",
    "[Info]   ",
    "[Debug]  "
}

Human-readable names of log levels.

Definition at line 44 of file logger.c.