syslog
[User Protocols]

Collaboration diagram for syslog:
Syslog protocol support. More...

Defines

#define SYSLOG_MAXBUF   256
 Syslog message buffer size.

Functions

void vsyslog (int pri, CONST char *fmt, va_list ap)
 Print log message.
void syslog (int pri, CONST char *fmt,...)
 Print log message.
void vsyslog_P (int pri, PGM_P fmt, va_list ap)
 Print log message.
void syslog_P (int pri, PGM_P 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().

Detailed Description

Syslog protocol support.


Define Documentation

#define SYSLOG_MAXBUF   256

Syslog message buffer size.

Definition at line 116 of file syslog.c.

Referenced by openlog(), vsyslog(), and vsyslog_P().


Function Documentation

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.

Parameters:
pri Priority level of this message. See syslog().
fmt Format string containing conversion specifications like printf.
ap List of arguments.

Definition at line 142 of file syslog.c.

References _fileno(), _write(), confos, _CONFOS::hostname, localtime(), LOG_FACMASK, LOG_MASK, LOG_NDELAY, LOG_PERROR, LOG_PRI, LOG_PRIMASK, NutUdpSendTo(), openlog(), sprintf, stderr, strcat(), strlen(), SYSLOG_MAXBUF, time(), _tm::tm_hour, _tm::tm_mday, _tm::tm_min, _tm::tm_mon, _tm::tm_sec, and vsprintf().

void syslog ( int  pri,
CONST char *  fmt,
  ... 
)

Print log message.

The message is tagged with priority.

Parameters:
pri Priority level of this message, selected from the following ordered list (high to low):
  • LOG_EMERG A panic condition.
  • LOG_ALERT A condition that should be corrected immediately.
  • LOG_CRIT Critical conditions, e.g., hard device errors.
  • LOG_ERR Errors.
  • LOG_WARNING Warning messages.
  • LOG_NOTICE Conditions that are not error conditions, but should possibly be handled specially.
  • LOG_INFO Informational messages.
  • LOG_DEBUG Messages that contain information normally of use only when debugging a program.
fmt Format string containing conversion specifications like printf.

Definition at line 222 of file syslog.c.

References vsyslog().

void vsyslog_P ( int  pri,
PGM_P  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.

Parameters:
pri Priority level of this message. See syslog().
fmt Format string containing conversion specifications like printf.
ap List of arguments.

Definition at line 242 of file syslog.c.

References _fileno(), _write(), confos, _CONFOS::hostname, localtime(), LOG_FACMASK, LOG_MASK, LOG_NDELAY, LOG_PERROR, LOG_PRI, LOG_PRIMASK, NutUdpSendTo(), openlog(), sprintf, stderr, strcat(), strlen(), strlen_P, SYSLOG_MAXBUF, time(), _tm::tm_hour, _tm::tm_mday, _tm::tm_min, _tm::tm_mon, _tm::tm_sec, and vsprintf_P().

void syslog_P ( int  pri,
PGM_P  fmt,
  ... 
)

Print log message.

The message is tagged with priority.

Parameters:
pri Priority level of this message, selected from the following ordered list (high to low):
  • LOG_EMERG A panic condition.
  • LOG_ALERT A condition that should be corrected immediately.
  • LOG_CRIT Critical conditions, e.g., hard device errors.
  • LOG_ERR Errors.
  • LOG_WARNING Warning messages.
  • LOG_NOTICE Conditions that are not error conditions, but should possibly be handled specially.
  • LOG_INFO Informational messages.
  • LOG_DEBUG Messages that contain information normally of use only when debugging a program.
fmt Format string containing conversion specifications like printf.

Definition at line 322 of file syslog.c.

References vsyslog_P().

int setlogmask ( int  logmask  ) 

Set the log priority mask level.

Calls to syslog() with a priority not set are ignored. The default allows all priorities to be logged.

Parameters:
logmask New priority mask.
Returns:
Previous mask.

Definition at line 343 of file syslog.c.

uint32_t setlogserver ( uint32_t  ip,
uint16_t  port 
)

Set the log server's IP address.

Parameters:
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.
Returns:
Previous IP.

Definition at line 361 of file syslog.c.

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().

Parameters:
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:
  • LOG_CONS Ignored but accepted for compatibility.
  • LOG_NDELAY Ignored but accepted for compatibility.
  • LOG_PERROR Additionally write the message to standard error output.
  • LOG_PID Ignored but accepted for compatibility.
logfac Encodes a default facility to be assigned to all messages that do not have an explicit facility encoded:
  • LOG_AUTH The authorization system:
  • LOG_AUTHPRIV The same as LOG_AUTH.
  • LOG_CRON The cron daemon,
  • LOG_DAEMON System daemons, that are not provided for explicitly by other facilities.
  • LOG_FTP The file transfer protocol daemon,
  • LOG_KERN Messages generated by the kernel. These should not be generated by applications.
  • LOG_LPR The line printer spooling system.
  • LOG_MAIL The mail system.
  • LOG_NEWS The network news system.
  • LOG_SYSLOG Messages generated internally by syslog.
  • LOG_USER This is the default facility identifier if none is specified.
  • LOG_UUCP The UUCP system.
  • LOG_LOCAL0..LOG_LOCAL7 Reserved for local use.

Definition at line 403 of file syslog.c.

References closelog(), LOG_NDELAY, malloc, NutUdpCreateSocket(), strcpy(), strlen(), and SYSLOG_MAXBUF.

void closelog ( void   ) 

Release system resources occupied by syslog().

Definition at line 434 of file syslog.c.

References free, and NutUdpDestroySocket().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/