Logo Tesseroids 1.0: User Manual and API Documentation

src/c/logger.c File Reference

Functions to set up logging. More...

#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include "logger.h"

Functions

void log_init (int level)
 Setup logging to stderr.
void log_tofile (FILE *logfile, int level)
 Set logging to a file.
void log_debug (const char *fmt,...)
 Log a message at debug level.
void log_info (const char *fmt,...)
 Log a message at info level.
void log_warning (const char *fmt,...)
 Log a message at warning level.
void log_error (const char *fmt,...)
 Log a message at error level.

Variables

LOGGER logger
 Global logger struct.

Detailed Description

Functions to set up logging.

Author:
Leonardo Uieda
Date:
31 Jan 2011

Function Documentation

void log_debug ( const char *  fmt,
  ... 
)

Log a message at debug level.

Pass parameters in the same format as printf()

Prints a newline at the end.

void log_error ( const char *  fmt,
  ... 
)

Log a message at error level.

Pass parameters in the same format as printf()

Prints a newline at the end.

void log_info ( const char *  fmt,
  ... 
)

Log a message at info level.

Pass parameters in the same format as printf()

Does not print "INFO: " in front of the message when logging

Prints a newline at the end.

void log_init ( int  level  ) 

Setup logging to stderr.

Parameters:
level level of logging to be made. Can be one of:

  • LOG_DEBUG
  • LOG_INFO
  • LOG_WARNING
  • LOG_ERROR
void log_tofile ( FILE *  logfile,
int  level 
)

Set logging to a file.

Parameters:
logfile FILE pointer to the already open file to log to.
level level of logging to be made to the file. Can be one of:

  • LOG_DEBUG
  • LOG_INFO
  • LOG_WARNING
  • LOG_ERROR
void log_warning ( const char *  fmt,
  ... 
)

Log a message at warning level.

Pass parameters in the same format as printf()

Prints a newline at the end.


Variable Documentation

Initial value:
 {.level = 100,
                 .file_level = 100,
                 .filelogging = 0,
                 .logfile = NULL}

Global logger struct.

Only declare in the main program!

Generated on Tue Apr 26 12:17:07 2011 for Tesseroids 1.0: User manual and API documentation by doxygen 1.6.3