-
Notifications
You must be signed in to change notification settings - Fork 18
/
syslog.h
93 lines (84 loc) · 4.15 KB
/
syslog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
// <syslog.h> - definitions for system error logging
//
// Extensions:
// - LOG_UPTO():
// Eases creation of logging mask for setlogmask(). Present on most
// common operating systems.
// - syslog_l() and vsyslog_l():
// syslog() and vsyslog() always use the C locale.
// - vsyslog():
// Allows for forwarding of arguments.
//
// Features missing:
// - syslog():
// Messages are not sent to a logging service, but written to stderr.
#ifndef _SYSLOG_H_
#define _SYSLOG_H_
#include <_/types.h>
// Flags for openlog(). These are ignored by this implementation.
#define LOG_PID 0 // Log the process ID with each message.
#define LOG_CONS 0 // Log to the system console on error.
#define LOG_NDELAY 0 // Connect to syslog daemon immediately.
#define LOG_ODELAY 0 // Delay open until syslog() is called.
#define LOG_NOWAIT 0 // Do not wait for child processes.
// Logging facilities. These are ignored by this implementation.
#define LOG_KERN 0 // Reserved for message generated by the system.
#define LOG_USER 0 // Message generated by a process.
#define LOG_MAIL 0 // Reserved for message generated by mail system.
#define LOG_NEWS 0 // Reserved for message generated by news system.
#define LOG_UUCP 0 // Reserved for message generated by UUCP system.
#define LOG_DAEMON 0 // Reserved for message generated by system daemon.
#define LOG_AUTH 0 // Reserved for message generated by authorization daemon.
#define LOG_CRON 0 // Reserved for message generated by clock daemon.
#define LOG_LPR 0 // Reserved for message generated by printer system.
#define LOG_LOCAL0 0 // Reserved for local use.
#define LOG_LOCAL1 0 // Reserved for local use.
#define LOG_LOCAL2 0 // Reserved for local use.
#define LOG_LOCAL3 0 // Reserved for local use.
#define LOG_LOCAL4 0 // Reserved for local use.
#define LOG_LOCAL5 0 // Reserved for local use.
#define LOG_LOCAL6 0 // Reserved for local use.
#define LOG_LOCAL7 0 // Reserved for local use.
#define LOG_MASK(pri) (1 << (pri))
#define LOG_UPTO(pri) (LOG_MASK((pri) + 1) - 1)
// Logging severities in descending order of importance.
#define LOG_EMERG 0 // A panic condition was reported to all processes.
#define LOG_ALERT 1 // A condition that should be corrected immediately.
#define LOG_CRIT 2 // A critical condition.
#define LOG_ERR 3 // An error message.
#define LOG_WARNING 4 // A warning message.
#define LOG_NOTICE 5 // A condition requiring special handling.
#define LOG_INFO 6 // A general information message.
#define LOG_DEBUG 7 // A message useful for debugging programs.
__BEGIN_DECLS
void closelog(void);
void openlog(const char *, int, int);
int setlogmask(int);
void syslog(int, const char *, ...);
void syslog_l(int, __locale_t, const char *, ...);
void vsyslog(int, const char *, __va_list);
void vsyslog_l(int, __locale_t, const char *, __va_list);
__END_DECLS
#endif