#include "log.h"
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <syslog.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
Defines | |
| #define | debug(prg) { if (debug_flag) { prg } } |
| Run debug code if debugging is enabled. | |
Functions | |
| void | LOGFilename (const char *filename) |
| Set the filename to be used by the logger. | |
| int | LOGInit (LogTarget lt, LogLevel max, const char *prefix) |
| Initialise the log subsystem. | |
| void | LOGShutdown () |
| Close down the log subsystem. | |
| void | LOGSetLevel (LogLevel max) |
| Set the maximum level. | |
| const char * | level_name (LogLevel ll) |
| Get a string representing the given log level. | |
| void | LOGWrite (LogLevel ll, const char *msg) |
| Write a message to the log file. | |
Variables | |
| const int | debug_flag = 0 |
| Control whether debug code is run. | |
| int | log_initialised = 0 |
| Flag indicating whether the log system has been initialised. | |
| LogTarget | log_targets = 0 |
| Bitmask defining which log systems messages should be sent to. | |
| LogLevel | log_level = 2 |
| Level indicating the maximum level of messages that should be logged. | |
| const char * | log_fname = NULL |
| Filename of the file currently being used for logging. | |
| const char * | log_prefix = "Glacsweb" |
| Prefix used when writing log messages to indicate their source. | |
| FILE * | log_fileptr |
| File pointer of the file currently being used for logging. | |
Copyright (C) 2004 Alistair Riddoch, The University of Southampton
|
|
Get a string representing the given log level.
|
|
|
Set the filename to be used by the logger. Must be called before LOGInit if file logging is enabled.
|
|
||||||||||||||||
|
Initialise the log subsystem. Initialise the log targets indicated, and set the maximum level and log prefix. If logging to file is required then the filename must have already been set using LOGFilename(). If an error occurs, logging is still enabled, but those targets which encountered an error will not be enabled.
|
|
|
Set the maximum level. The maximum level can be changed only after logging has been initialised.
|
|
|
Close down the log subsystem. Close any of the log targets which need to be closed. |
|
||||||||||||
|
Write a message to the log file. If the level given is less than or equal to the maximum level, the message will be logged to the enabled log targets.
|
|
|
Control whether debug code is run. Set to non-zero if debug code should be run. |
|
|
Flag indicating whether the log system has been initialised. Set to non-zero when the log system is successfully started up. |
|
|
Level indicating the maximum level of messages that should be logged. Messages above this level (of lower priority) are discarded. |
1.3.5