Syslog protocol support. More...
Functions | |
size_t | syslog_header (int pri) |
Assemble syslog header. | |
void | syslog_flush (size_t len) |
Send syslog buffer. | |
void | vsyslog (int pri, CONST char *fmt, va_list ap) |
Print log message. | |
void | syslog (int pri, CONST char *fmt,...) |
Print log message. | |
int | setlogmask (int logmask) |
Set the log priority mask level. | |
uint32_t | setlogserver (uint32_t ip, uint16_t port) |
Set the log server's IP address. | |
void | openlog (CONST char *ident, int logstat, int logfac) |
Open logging for specialized processing. | |
void | closelog (void) |
Release system resources occupied by syslog(). | |
void | vsyslog_P (int pri, PGM_P fmt_P, va_list ap) |
Print log message. | |
void | syslog_P (int pri, PGM_P fmt_P,...) |
Print log message. | |
Variables | |
char * | syslog_buf |
Syslog protocol support.
size_t syslog_header | ( | int | pri | ) |
Assemble syslog header.
For internal use only.
pri | Value of the syslog PRI part. |
Definition at line 138 of file syslog.c.
References _CONFNET::cdn_cip_addr, _CONFNET::cdn_ip_addr, confnet, confos, gmtime(), _CONFOS::hostname, inet_ntoa(), localtime(), LOG_FACMASK, LOG_MASK, LOG_NDELAY, LOG_PRI, LOG_PRIMASK, openlog(), sprintf, strcpy(), strlen(), syslog_buf, time(), _tm::tm_hour, _tm::tm_mday, _tm::tm_min, _tm::tm_mon, _tm::tm_sec, and _tm::tm_year.
Referenced by vsyslog(), and vsyslog_P().
void syslog_flush | ( | size_t | len | ) |
Send syslog buffer.
For internal use only.
len | Number of valid characters in buffer. |
Definition at line 270 of file syslog.c.
References _fileno(), _write(), LOG_PERROR, NutUdpSendTo(), stderr, and syslog_buf.
Referenced by vsyslog(), and vsyslog_P().
void vsyslog | ( | int | pri, |
CONST char * | fmt, | ||
va_list | ap | ||
) |
Print log message.
Alternate form of syslog(), in which the arguments have already been captured using the variable-length argument facilities.
pri | Priority level of this message. See syslog(). |
fmt | Format string containing conversion specifications like printf. |
ap | List of arguments. |
Definition at line 295 of file syslog.c.
References fputc(), fputs(), puts, stderr, strlen(), syslog_buf, syslog_flush(), syslog_header(), vfprintf(), and vsprintf().
Referenced by syslog().
void syslog | ( | int | pri, |
CONST char * | fmt, | ||
... | |||
) |
Print log message.
The message is tagged with priority.
pri | Priority level of this message, selected from the following ordered list (high to low):
|
fmt | Format string containing conversion specifications like printf. |
Definition at line 336 of file syslog.c.
References vsyslog().
Referenced by main().
int setlogmask | ( | int | logmask | ) |
Set the log server's IP address.
ip | IP address in network byte order. If 0, no messages will be sent out. |
port | Port number. If 0, then standard port is used. |
Definition at line 373 of file syslog.c.
Referenced by main().
void openlog | ( | CONST char * | ident, |
int | logstat, | ||
int | logfac | ||
) |
Open logging for specialized processing.
This function provides for more specialized processing of the messages sent by syslog() and vsyslog().
ident | This string that will be prepended to every message. |
logstat | A bit field specifying logging options, which is formed by OR'ing one or more of the following values:
|
logfac | Encodes a default facility to be assigned to all messages that do not have an explicit facility encoded:
|
Definition at line 419 of file syslog.c.
References closelog(), LOG_NDELAY, malloc(), NutUdpCreateSocket(), strcpy(), strlen(), and syslog_buf.
Referenced by main(), and syslog_header().
void closelog | ( | void | ) |
Release system resources occupied by syslog().
Definition at line 450 of file syslog.c.
References free(), NutUdpDestroySocket(), and syslog_buf.
Referenced by openlog().
void vsyslog_P | ( | int | pri, |
PGM_P | fmt_P, | ||
va_list | ap | ||
) |
Print log message.
Alternate form of syslog(), in which the arguments have already been captured using the variable-length argument facilities.
This variant is useful for Harvard architectures only. It allows to place the format string in program space. For other CPUs it is mapped to vsyslog().
pri | Priority level of this message. See syslog(). |
fmt_P | Format string containing conversion specifications like printf. |
ap | List of arguments. |
Definition at line 99 of file syslog_P.c.
References fputc(), fputs(), stderr, strlen_P, syslog_buf, syslog_flush(), syslog_header(), vfprintf_P(), and vsprintf_P().
Referenced by syslog_P().
void syslog_P | ( | int | pri, |
PGM_P | fmt_P, | ||
... | |||
) |
Print log message.
The message is tagged with priority.
This variant is useful for Harvard architectures only. It allows to place the format string in program space. For other CPUs it is mapped to syslog().
pri | Priority level of this message, selected from the following ordered list (high to low):
|
fmt_P | Format string containing conversion specifications like printf. |
Definition at line 143 of file syslog_P.c.
References vsyslog_P().
char* syslog_buf |
Definition at line 127 of file syslog.c.
Referenced by closelog(), openlog(), syslog_flush(), syslog_header(), vsyslog(), and vsyslog_P().