2007-04-16 13:28:29 +04:00
|
|
|
|
/*
|
|
|
|
|
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
|
*
|
|
|
|
|
* Documentation written by:
|
|
|
|
|
* Axel D<>rfler
|
|
|
|
|
* Niels Sascha Reedijk <niels.reedijk@gmail.com>
|
|
|
|
|
* Corresponds to:
|
|
|
|
|
* /trunk/headers/posix/syslog.h rev 6684
|
|
|
|
|
*/
|
|
|
|
|
|
2006-09-12 16:13:49 +04:00
|
|
|
|
/*!
|
2007-04-16 13:28:29 +04:00
|
|
|
|
\file syslog.h
|
|
|
|
|
\ingroup support
|
|
|
|
|
\ingroup libroot
|
|
|
|
|
\brief System logging capabilities
|
2005-03-14 19:27:04 +03:00
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
The functions described here are interacting with the syslog_daemon, a server
|
|
|
|
|
that provides the system logging capabilities.
|
|
|
|
|
The log can be found in /var/log/syslog.
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void closelog(void)
|
|
|
|
|
\brief Closes the current log session
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void openlog(const char *ident, int options, int facility)
|
|
|
|
|
\brief Starts a log session, and sets some output options
|
2005-03-14 19:27:04 +03:00
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
Like openlog_thread() this function defines the log session in thread context; the
|
|
|
|
|
global options set by openlog_team() are not affected by this function.
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn int setlogmask(int priorityMask)
|
|
|
|
|
\brief sets the logging priority mask
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void syslog(int priority, const char *message, ...)
|
|
|
|
|
\brief sends a message to the system log
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void closelog_team(void)
|
|
|
|
|
\brief Closes the log
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void openlog_team(const char *ident, int logopt, int facility)
|
|
|
|
|
\brief Starts a log session, and sets some output options
|
2005-03-14 19:27:04 +03:00
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
This function defines the team-wide logging options. Thread local sessions
|
|
|
|
|
started with openlog() or openlog_thread() will inherit the options of the
|
|
|
|
|
global session.
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void log_team(int priority, const char *message, ...)
|
|
|
|
|
\brief sends a message to the system log
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn int setlogmask_team(int priorityMask)
|
|
|
|
|
\brief sets the logging priority mask
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void closelog_thread(void)
|
|
|
|
|
\brief Closes the log
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void openlog_thread(const char *ident, int logopt, int facility)
|
|
|
|
|
\brief Starts a log session, and sets some output options
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn void log_thread(int priority, const char *message, ...)
|
|
|
|
|
\brief sends a message to the system log
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\fn int setlogmask_thread(int priorityMask)
|
|
|
|
|
\brief sets the logging priority mask
|
2005-03-14 19:27:04 +03:00
|
|
|
|
*/
|
2006-12-27 20:46:38 +03:00
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\name Options for openlog()
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\def LOG_PID
|
|
|
|
|
\brief Log the process (thread/team) ID with each message
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_CONS
|
|
|
|
|
\brief Log to the system console on error
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_ODELAY
|
|
|
|
|
\brief Delay open until syslog() is called
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_NDELAY
|
|
|
|
|
\brief Connect to the syslog daemon immediately
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_SERIAL
|
|
|
|
|
\brief Dump to serial output as well.
|
|
|
|
|
\attention This is not yet implemented
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_PERROR
|
|
|
|
|
\brief Dump to stderr as well
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_NOWAIT
|
|
|
|
|
\brief Do not wait for child processes
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
2006-12-27 20:46:38 +03:00
|
|
|
|
\name Facilities for openlog()
|
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\def LOG_KERN
|
|
|
|
|
\brief Reserved for messages generated by the kernel.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_USER
|
|
|
|
|
\brief Reserved for messages generated by user processes.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_MAIL
|
|
|
|
|
\brief Standard (?) POSIX facility for messages by the mailing daemon.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_DAEMON
|
|
|
|
|
\brief Standard POSIX (?) facility for messages by daemons (and Haiku servers).
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_AUTH
|
|
|
|
|
\brief Standard POSIX facility(?) for messages by the authentication services.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_SYSLOG
|
|
|
|
|
\brief Reserved for messages generated by the syslog daemon.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LPR
|
|
|
|
|
\brief Reserved for messages generated by the UNIX lpr printing tool.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_NEWS
|
|
|
|
|
\brief Reserved for messages generated by something UNIXy that does something with NEWS.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_UUCP
|
|
|
|
|
\brief Reserved for messages generated by UUCP
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_CRON
|
|
|
|
|
\brief Reserved for messages generated by the CRON daemon.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_AUTHPRIV
|
|
|
|
|
\brief Reserved for private (?) messages that relate to authentication.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL0
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL1
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL2
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL3
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL4
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL5
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL6
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_LOCAL7
|
|
|
|
|
\brief Use this for local use.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
2006-12-27 20:46:38 +03:00
|
|
|
|
\name Priorities for syslog(), log_team() and log_thread()
|
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
//! @{
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\def LOG_EMERG
|
|
|
|
|
\brief A panic condition
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_PANIC
|
|
|
|
|
\brief An alias for LOG_EMERG
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_ALERT
|
|
|
|
|
\brief A condition to that should be corrected immediately
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_CRIT
|
|
|
|
|
\brief Critical conditions like hard drive errors
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_ERR
|
|
|
|
|
\brief Errors
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_WARNING
|
|
|
|
|
\brief Warnings
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_NOTICE
|
|
|
|
|
\brief Notices, instructions on how to use certain configuration options.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_INFO
|
|
|
|
|
\brief Information, like versions and so.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_DEBUG
|
|
|
|
|
\brief Debug information.
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/\
|
|
|
|
|
|
|
|
|
|
//! @}
|
|
|
|
|
|
2007-04-16 13:28:29 +04:00
|
|
|
|
/*!
|
|
|
|
|
\def LOG_MASK
|
|
|
|
|
\brief Converts a priority definition for use in setlogmask()
|
2006-12-27 20:46:38 +03:00
|
|
|
|
*/
|