|
MLIB
|
syslog related functions. More...
#include "safe_winsock.h"Go to the source code of this file.
Macros | |
| #define | LOG_USER (1 << 3) |
| facility for random user-level messages | |
| #define | LOG_PORT 514 |
| port number for logger (same as SYSLOG service) | |
Priorities | |
priorities/facilities are encoded into a single 32-bit quantity, where the bottom 3 bits are the priority (0-7) and the top 28 bits are the facility (0-big number). This is the mapping of priority codes. | |
| #define | LOG_EMERG 0 |
| system is unusable | |
| #define | LOG_ALERT 1 |
| action must be taken immediately | |
| #define | LOG_CRIT 2 |
| critical conditions | |
| #define | LOG_ERR 3 |
| error conditions | |
| #define | LOG_WARNING 4 |
| warning conditions | |
| #define | LOG_NOTICE 5 |
| normal but significant condition | |
| #define | LOG_INFO 6 |
| informational | |
| #define | LOG_DEBUG 7 |
| debug-level messages | |
Masks and Operations | |
The following definitions can be used for operations on priorities and facilities. See syslog() and setlogmask() for examples. | |
| #define | LOG_PRIMASK 0x7 |
| mask to extract priority part | |
| #define | LOG_FACMASK 0x03f8 |
| mask to extract facility part | |
| #define | LOG_MASK(pri) |
| mask for one priority | |
| #define | LOG_UPTO(pri) |
| #define | LOG_MAKEPRI(fac, pri) |
| Used for arguments to syslog. | |
Flags for openlog | |
The following flags can be specified in the opt argument of openlog(): BSD stuff | |
| #define | LOG_PID 0x01 /* log the pid with each message */ |
| log the process id with each message | |
| #define | LOG_CONS 0x02 /* log on the console if errors in sending */ |
| log the process id with each message | |
| #define | LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ |
| log the process id with each message | |
| #define | LOG_NDELAY 0x08 /* don't delay open */ |
| log the process id with each message | |
| #define | LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ |
| log the process id with each message | |
| #define | LOG_PERROR 0x20 /* log to stderr as well */ |
| log the process id with each message | |
| #define | LOGOPT_PID 0x01 |
| log the process id with each message | |
| #define | LOGOPT_OUTDEBUG 0x02 |
| log to Windows debug port (OutputDebugString) | |
| #define | LOGOPT_NOUDP 0x40 |
| do not send UDP data | |
| #define | LOGOPT_FILE 0x80 |
| log to disk file | |
Functions | |
| void | closelog (void) |
| Close connection to logger. | |
| void | openlog (const char *ident, int option=0, int facility=LOG_USER) |
| Open connection to logger. | |
| int | setlogmask (int mask) |
| Set the log mask level. | |
| int | setlogopt (int opt) |
| Set option flags. | |
| void | syslog (int priority, const char *fmt,...) |
| Generate a log message using FMT string and option arguments. | |
| void | syslog (int priority, const std::string &msg) |
| String-oriented version of syslog function. | |
| bool | syslog_debug (const char *fmt,...) |
| Generate a log message at debug level using FMT string and option arguments. | |
syslog related functions.
The header file is a shameless copy of the original BSD syslog.h file, however implementations are new.
| #define LOG_MAKEPRI | ( | fac, | |
| pri ) |
Used for arguments to syslog.
| #define LOG_MASK | ( | pri | ) |
mask for one priority
| #define LOG_UPTO | ( | pri | ) |
all priorities through pri