147133Sobrien/**
247133Sobrien * D header file for POSIX system logger API.
347133Sobrien * (http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html)
447133Sobrien *
547133Sobrien * Copyright: Copyright Adil Baig 2013.
647133Sobrien * License:   $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
747133Sobrien * Authors:   Adil Baig
847133Sobrien * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
947133Sobrien */
1047133Sobrien
1147133Sobrien/*          Copyright Adil Baig 2013.
1247133Sobrien * Distributed under the Boost Software License, Version 1.0.
1347133Sobrien *    (See accompanying file LICENSE or copy at
1447133Sobrien *          http://www.boost.org/LICENSE_1_0.txt)
1547133Sobrien */
1647133Sobrienmodule core.sys.posix.syslog;
1747133Sobrien
1847133Sobrienversion (OSX)
1947133Sobrien    version = Darwin;
2047133Sobrienelse version (iOS)
2147133Sobrien    version = Darwin;
2247133Sobrienelse version (TVOS)
2347133Sobrien    version = Darwin;
2447133Sobrienelse version (WatchOS)
2547133Sobrien    version = Darwin;
2651594Speter
2750477Speterversion (Posix):
2847133Sobrien
2955723Simpextern (C) nothrow @nogc:
3055723Simp@system:
3147133Sobrien
3247133Sobrienversion (CRuntime_Glibc)
3348114Sobrien{
3448114Sobrien    //PRIORITY
3548114Sobrien    enum {
3648114Sobrien        LOG_EMERG = 0,     /* system is unusable */
3748114Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
3848114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
3948114Sobrien        LOG_ERR   = 3,     /* error conditions */
4048114Sobrien        LOG_WARNING = 4,   /* warning conditions */
4148114Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
4248114Sobrien        LOG_INFO    = 6,   /* informational */
4348114Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
4448114Sobrien    }
4548114Sobrien
4648114Sobrien    //OPTIONS
4748114Sobrien    enum {
4848114Sobrien        LOG_PID    = 0x01,  /* log the pid with each message */
4948114Sobrien        LOG_CONS   = 0x02,  /* log on the console if errors in sending */
5048114Sobrien        LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
5148114Sobrien        LOG_NDELAY = 0x08,  /* don't delay open */
5248114Sobrien        LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
5348114Sobrien        LOG_PERROR = 0x20,  /* log to stderr as well */
5448114Sobrien    }
5548114Sobrien
5648114Sobrien    //FACILITY
5748114Sobrien    enum {
5848114Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
5948114Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
6048114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
6148114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
6248114Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
6348114Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
6448114Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
6548114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
6648114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
6748114Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
6848114Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
6947133Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
7047133Sobrien
7148114Sobrien        /* other codes through 15 reserved for system use */
7248114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
7348114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
7448114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
7547133Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
7648114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
7748114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
7848114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
7947133Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
8048114Sobrien
8148114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
8248114Sobrien    }
8348114Sobrien
8447133Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
8548114Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
8647133Sobrien
8748114Sobrien    void openlog (const char *, int __option, int __facility);
8847133Sobrien    int  setlogmask (int __mask);
8948114Sobrien    void syslog (int __pri, const char *__fmt, ...);
9048114Sobrien    void closelog();
9148114Sobrien}
9248114Sobrienelse version (Darwin)
9347133Sobrien{
9448114Sobrien    //http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/osfmk/sys/syslog.h
9548114Sobrien
9648114Sobrien    //PRIORITY
9748114Sobrien    enum {
9848114Sobrien        LOG_EMERG = 0,     /* system is unusable */
9948114Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
10048114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
10148114Sobrien        LOG_ERR   = 3,     /* error conditions */
10248114Sobrien        LOG_WARNING = 4,   /* warning conditions */
10348114Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
10448114Sobrien        LOG_INFO    = 6,   /* informational */
10548114Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
10648114Sobrien    }
10748114Sobrien
10848114Sobrien    //OPTIONS
10947133Sobrien    enum {
11048114Sobrien        LOG_PID    = 0x01,     /* log the pid with each message */
11148114Sobrien        LOG_CONS   = 0x02,  /* log on the console if errors in sending */
11247133Sobrien        LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
11347133Sobrien        LOG_NDELAY = 0x08,  /* don't delay open */
11448114Sobrien        LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
11547133Sobrien    }
11648114Sobrien
11747133Sobrien    //FACILITY
11848114Sobrien    enum {
11948114Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
12048114Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
12148114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
12248114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
12347133Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
12448114Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
12548114Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
12648114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
12748114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
12848114Sobrien
12948114Sobrien        /* other codes through 15 reserved for system use */
13048114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
13148114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
13247133Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
13348114Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
13448114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
13548114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
13648114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
13748114Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
13848114Sobrien
13948114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
14048114Sobrien    }
14148114Sobrien
14248114Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
14348114Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
14448114Sobrien
14548114Sobrien    void openlog (const char *, int __option, int __facility);
14648114Sobrien    int  setlogmask (int __mask);
14748114Sobrien    void syslog (int __pri, const char *__fmt, ...);
14847133Sobrien    void closelog();
14948114Sobrien}
15048114Sobrienelse version (FreeBSD)
15148114Sobrien{
15247133Sobrien    //http://fxr.watson.org/fxr/source/sys/syslog.h
15347133Sobrien
15448114Sobrien    //PRIORITY
15547133Sobrien    enum {
15648114Sobrien        LOG_EMERG = 0,     /* system is unusable */
15747133Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
15848114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
15948114Sobrien        LOG_ERR   = 3,     /* error conditions */
16048114Sobrien        LOG_WARNING = 4,   /* warning conditions */
16148114Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
16248114Sobrien        LOG_INFO    = 6,   /* informational */
16347133Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
16448114Sobrien    }
16548114Sobrien
16648114Sobrien    //OPTIONS
16748114Sobrien    enum {
16848114Sobrien        LOG_PID    = 0x01,    /* log the pid with each message */
16948114Sobrien        LOG_CONS   = 0x02,    /* log on the console if errors in sending */
17048114Sobrien        LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
17148114Sobrien        LOG_NDELAY = 0x08,    /* don't delay open */
17248114Sobrien        LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
17347133Sobrien        LOG_PERROR = 0x20,    /* log to stderr as well */
17448114Sobrien    }
17548114Sobrien
17648114Sobrien    //FACILITY
17748114Sobrien    enum {
17848114Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
17947133Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
18048114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
18148114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
18247133Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
18347133Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
18447133Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
18548114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
18648114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
18747133Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
18847133Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
18947133Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
19048114Sobrien        LOG_NTP    = (12<<3), /* NTP subsystem */
19148114Sobrien        LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
19248114Sobrien        LOG_CONSOLE  = (14<<3), /* /dev/console output */
19348114Sobrien
19448114Sobrien        /* other codes through 15 reserved for system use */
19547133Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
19648114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
19748114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
19848114Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
19948114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
20048114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
20148114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
20248114Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
20348114Sobrien
20448114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
20548114Sobrien    }
20648114Sobrien
20748114Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
20848114Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
20948114Sobrien
21048114Sobrien    void openlog (const char *, int __option, int __facility);
21148114Sobrien    int  setlogmask (int __mask);
21248114Sobrien    void syslog (int __pri, const char *__fmt, ...);
21348114Sobrien    void closelog();
21448114Sobrien}
21548114Sobrienelse version (NetBSD)
21648114Sobrien{
21748114Sobrien    //http://fxr.watson.org/fxr/source/sys/syslog.h
21848114Sobrien
21948114Sobrien    //PRIORITY
22048114Sobrien    enum {
22148114Sobrien        LOG_EMERG = 0,     /* system is unusable */
22248114Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
22348114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
22448114Sobrien        LOG_ERR   = 3,     /* error conditions */
22548114Sobrien        LOG_WARNING = 4,   /* warning conditions */
22648114Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
22748114Sobrien        LOG_INFO    = 6,   /* informational */
22848114Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
22948114Sobrien    }
23048114Sobrien
23148114Sobrien    //OPTIONS
23248114Sobrien    enum {
23348114Sobrien        LOG_PID    = 0x01,    /* log the pid with each message */
23448114Sobrien        LOG_CONS   = 0x02,    /* log on the console if errors in sending */
23548114Sobrien        LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
23648114Sobrien        LOG_NDELAY = 0x08,    /* don't delay open */
23748114Sobrien        LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
23848114Sobrien        LOG_PERROR = 0x20,    /* log to stderr as well */
23948114Sobrien    }
24048114Sobrien
24148114Sobrien    //FACILITY
24248114Sobrien    enum {
24348114Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
24448114Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
24548114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
24648114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
24748114Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
24848114Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
24948114Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
25048114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
25148114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
25248114Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
25348114Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
25448114Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
25548114Sobrien        LOG_NTP    = (12<<3), /* NTP subsystem */
25648114Sobrien        LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
25748114Sobrien        LOG_CONSOLE  = (14<<3), /* /dev/console output */
25848114Sobrien
25948114Sobrien        /* other codes through 15 reserved for system use */
26048114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
26148114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
26248114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
26348114Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
26448114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
26548114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
26648114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
26748114Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
26848114Sobrien
26948114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
27048114Sobrien    }
27148114Sobrien
27248114Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
27348114Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
27448114Sobrien
27548114Sobrien    void openlog (const char *, int __option, int __facility);
27648114Sobrien    int  setlogmask (int __mask);
27748114Sobrien    void syslog (int __pri, const char *__fmt, ...);
27848114Sobrien    void closelog();
27948114Sobrien}
28048114Sobrienelse version (OpenBSD)
28148114Sobrien{
28248114Sobrien    //PRIORITY
28348114Sobrien    enum
28448114Sobrien    {
28548114Sobrien        LOG_EMERG = 0,     /* system is unusable */
286121099Srsm        LOG_ALERT = 1,     /* action must be taken immediately */
28748114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
28848114Sobrien        LOG_ERR   = 3,     /* error conditions */
28948114Sobrien        LOG_WARNING = 4,   /* warning conditions */
29048114Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
29148114Sobrien        LOG_INFO    = 6,   /* informational */
292121099Srsm        LOG_DEBUG   = 7,   /* debug-level messages */
293121099Srsm    }
294121099Srsm
29548114Sobrien    //OPTIONS
29648114Sobrien    enum
29748114Sobrien    {
29848114Sobrien        LOG_PID    = 0x01,    /* log the pid with each message */
29948114Sobrien        LOG_CONS   = 0x02,    /* log on the console if errors in sending */
30048114Sobrien        LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
30148114Sobrien        LOG_NDELAY = 0x08,    /* don't delay open */
30248114Sobrien        LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
30348114Sobrien        LOG_PERROR = 0x20,    /* log to stderr as well */
30448114Sobrien    }
30548114Sobrien
30648114Sobrien    //FACILITY
30747133Sobrien    enum
30847133Sobrien    {
30948114Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
31048114Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
31148114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
31248114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
31348114Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
31447133Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
31548114Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
31648114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
31748114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
31848114Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
31948114Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
32048114Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
32148114Sobrien        // OpenBSD does not define the following:
32248114Sobrien        //LOG_NTP
32348114Sobrien        //LOG_SECURITY
32448114Sobrien        //LOG_CONSOLE
32548114Sobrien
32647133Sobrien        /* other codes through 15 reserved for system use */
32748114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
32848114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
32948114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
33048114Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
33148114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
33248114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
33348114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
33448114Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
33548114Sobrien
33648114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
33748114Sobrien    }
33848114Sobrien
33948114Sobrien    extern(D) int LOG_MASK(int pri) { return 1 << pri; }            /* mask for one priority */
34048114Sobrien    extern(D) int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
34148114Sobrien
34248114Sobrien    void openlog(const char *, int, int);
34348114Sobrien    int  setlogmask(int);
34448114Sobrien    void syslog(int, const char *, ...);
34548114Sobrien    void closelog();
34648114Sobrien}
34748114Sobrienelse version (DragonFlyBSD)
34848114Sobrien{
34948114Sobrien    //PRIORITY
35048114Sobrien    enum {
35148114Sobrien        LOG_EMERG = 0,     /* system is unusable */
35248114Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
35348114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
35448114Sobrien        LOG_ERR   = 3,     /* error conditions */
35547133Sobrien        LOG_WARNING = 4,   /* warning conditions */
35648114Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
35748114Sobrien        LOG_INFO    = 6,   /* informational */
35848114Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
35948114Sobrien    }
36048114Sobrien
36148114Sobrien    //OPTIONS
36247133Sobrien    enum {
36347133Sobrien        LOG_PID    = 0x01,    /* log the pid with each message */
36448114Sobrien        LOG_CONS   = 0x02,    /* log on the console if errors in sending */
36548114Sobrien        LOG_ODELAY = 0x04,    /* delay open until first syslog() (default) */
36648114Sobrien        LOG_NDELAY = 0x08,    /* don't delay open */
36748114Sobrien        LOG_NOWAIT = 0x10,    /* don't wait for console forks: DEPRECATED */
36848114Sobrien        LOG_PERROR = 0x20,    /* log to stderr as well */
36948114Sobrien    }
37047133Sobrien
37148114Sobrien    //FACILITY
37248114Sobrien    enum {
373121099Srsm        LOG_KERN   = (0<<3),  /* kernel messages */
37448114Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
37548114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
37648114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
37748114Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
37847133Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
37948114Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
380121099Srsm        LOG_NEWS   = (7<<3),  /* network news subsystem */
381121099Srsm        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
38248114Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
38348114Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
38448114Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
38548114Sobrien        LOG_NTP    = (12<<3), /* NTP subsystem */
38648114Sobrien        LOG_SECURITY = (13<<3), /* security subsystems (firewalling, etc.) */
38748114Sobrien        LOG_CONSOLE  = (14<<3), /* /dev/console output */
38848114Sobrien
38948114Sobrien        /* other codes through 15 reserved for system use */
39048114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
39148114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
39248114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
39348114Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
39448114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
39548114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
39648114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
39747133Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
39848114Sobrien
39947133Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
40048114Sobrien    }
40148114Sobrien
40248114Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
40348114Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
40447133Sobrien
40547133Sobrien    void openlog (const char *, int __option, int __facility);
40647133Sobrien    int  setlogmask (int __mask);
40748114Sobrien    void syslog (int __pri, const char *__fmt, ...);
40847133Sobrien    void closelog();
40948114Sobrien}
41048114Sobrienelse version (Solaris)
41148114Sobrien{
41248114Sobrien    //http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html
41347133Sobrien
41448114Sobrien    //PRIORITY
41547133Sobrien    enum {
41648114Sobrien        LOG_EMERG = 0,     /* system is unusable */
41747133Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
41848114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
41948114Sobrien        LOG_ERR   = 3,     /* error conditions */
42048114Sobrien        LOG_WARNING = 4,   /* warning conditions */
42148114Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
42247133Sobrien        LOG_INFO    = 6,   /* informational */
42347133Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
42447133Sobrien    }
42548114Sobrien
42647133Sobrien    //OPTIONS
42748114Sobrien    enum {
42848114Sobrien        LOG_PID = 0x01,     /* log the pid with each message */
42948114Sobrien        LOG_CONS   = 0x02,  /* log on the console if errors in sending */
43047133Sobrien        LOG_NDELAY = 0x08,  /* don't delay open */
43148114Sobrien        LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
43248114Sobrien    }
43348114Sobrien
43448114Sobrien    //FACILITY
43547133Sobrien    enum {
43648114Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
43747133Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
43848114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
43947133Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
44048114Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
44148114Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
44248114Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
44348114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
44448114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
44548114Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
44648114Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
44747133Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
44848114Sobrien
44948114Sobrien        /* other codes through 15 reserved for system use */
45048114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
45148114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
45248114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
45348114Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
45448114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
45548114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
45647133Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
45748114Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
45848114Sobrien
45948114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
46048114Sobrien    }
46148114Sobrien
46248114Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
46348114Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
46448114Sobrien
46548114Sobrien    void openlog (const char *, int __option, int __facility);
46648114Sobrien    int  setlogmask (int __mask);
46748114Sobrien    void syslog (int __pri, const char *__fmt, ...);
46848114Sobrien    void closelog();
46948114Sobrien}
47048114Sobrienelse version (CRuntime_UClibc)
47148114Sobrien{
47248114Sobrien    //PRIORITY
47348114Sobrien    enum {
47448114Sobrien        LOG_EMERG = 0,     /* system is unusable */
47548114Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
47648114Sobrien        LOG_CRIT  = 2,     /* critical conditions */
47748114Sobrien        LOG_ERR   = 3,     /* error conditions */
47848114Sobrien        LOG_WARNING = 4,   /* warning conditions */
479121099Srsm        LOG_NOTICE  = 5,   /* normal but significant condition */
48048114Sobrien        LOG_INFO    = 6,   /* informational */
48148114Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
48248114Sobrien    }
48348114Sobrien
48448114Sobrien    //OPTIONS
48548114Sobrien    enum {
48648114Sobrien        LOG_PID    = 0x01,  /* log the pid with each message */
48748114Sobrien        LOG_CONS   = 0x02,  /* log on the console if errors in sending */
48848114Sobrien        LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
48948114Sobrien        LOG_NDELAY = 0x08,  /* don't delay open */
49048114Sobrien        LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
49148114Sobrien        LOG_PERROR = 0x20,  /* log to stderr as well */
49248114Sobrien    }
49348114Sobrien
49448114Sobrien    //FACILITY
49548114Sobrien    enum {
49648114Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
49748114Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
49848114Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
49948114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
50047133Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
50148114Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
50247133Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
50348114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
50448114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
50548114Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
50648114Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
50747133Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
50848114Sobrien
50948114Sobrien        /* other codes through 15 reserved for system use */
51048114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
51148114Sobrien        LOG_LOCAL1 = (17<<3), /* reserved for local use */
51248114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
513121099Srsm        LOG_LOCAL3 = (19<<3), /* reserved for local use */
51448114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
51547133Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
51648114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
51748114Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
51848114Sobrien
51948114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
52048114Sobrien    }
52148114Sobrien
52248114Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
52348114Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
52448114Sobrien
52547133Sobrien    void openlog (const char *, int __option, int __facility);
52648114Sobrien    int  setlogmask (int __mask);
52747133Sobrien    void syslog (int __pri, const char *__fmt, ...);
52848114Sobrien    void closelog();
52948114Sobrien}
53048114Sobrienelse version (CRuntime_Musl)
53148114Sobrien{
53247133Sobrien    //PRIORITY
53347133Sobrien    enum {
53447133Sobrien        LOG_EMERG = 0,     /* system is unusable */
53548114Sobrien        LOG_ALERT = 1,     /* action must be taken immediately */
53647133Sobrien        LOG_CRIT  = 2,     /* critical conditions */
53748114Sobrien        LOG_ERR   = 3,     /* error conditions */
53847133Sobrien        LOG_WARNING = 4,   /* warning conditions */
53947133Sobrien        LOG_NOTICE  = 5,   /* normal but significant condition */
54048114Sobrien        LOG_INFO    = 6,   /* informational */
54148114Sobrien        LOG_DEBUG   = 7,   /* debug-level messages */
54248114Sobrien    }
54348114Sobrien
54448114Sobrien    //OPTIONS
54548114Sobrien    enum {
54648114Sobrien        LOG_PID    = 0x01,  /* log the pid with each message */
54748114Sobrien        LOG_CONS   = 0x02,  /* log on the console if errors in sending */
54848114Sobrien        LOG_ODELAY = 0x04,  /* delay open until first syslog() (default) */
54948114Sobrien        LOG_NDELAY = 0x08,  /* don't delay open */
55048114Sobrien        LOG_NOWAIT = 0x10,  /* don't wait for console forks: DEPRECATED */
55148114Sobrien        LOG_PERROR = 0x20,  /* log to stderr as well */
55248114Sobrien    }
55348114Sobrien
55448114Sobrien    //FACILITY
55547136Sobrien    enum {
55647133Sobrien        LOG_KERN   = (0<<3),  /* kernel messages */
55748114Sobrien        LOG_USER   = (1<<3),  /* random user-level messages */
55847136Sobrien        LOG_MAIL   = (2<<3),  /* mail system */
55948114Sobrien        LOG_DAEMON = (3<<3),  /* system daemons */
56048114Sobrien        LOG_AUTH   = (4<<3),  /* security/authorization messages */
56148114Sobrien        LOG_SYSLOG = (5<<3),  /* messages generated internally by syslogd */
56248114Sobrien        LOG_LPR    = (6<<3),  /* line printer subsystem */
56348114Sobrien        LOG_NEWS   = (7<<3),  /* network news subsystem */
56448114Sobrien        LOG_UUCP   = (8<<3),  /* UUCP subsystem */
56547136Sobrien        LOG_CRON   = (9<<3),  /* clock daemon */
56648114Sobrien        LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */
56748114Sobrien        LOG_FTP    =  (11<<3), /* ftp daemon */
56848114Sobrien
56948114Sobrien        /* other codes through 15 reserved for system use */
57048114Sobrien        LOG_LOCAL0 = (16<<3), /* reserved for local use */
571150989Spjd        LOG_LOCAL1 = (17<<3), /* reserved for local use */
57248114Sobrien        LOG_LOCAL2 = (18<<3), /* reserved for local use */
57348114Sobrien        LOG_LOCAL3 = (19<<3), /* reserved for local use */
57448114Sobrien        LOG_LOCAL4 = (20<<3), /* reserved for local use */
57548114Sobrien        LOG_LOCAL5 = (21<<3), /* reserved for local use */
57648114Sobrien        LOG_LOCAL6 = (22<<3), /* reserved for local use */
57748114Sobrien        LOG_LOCAL7 = (23<<3), /* reserved for local use */
57848114Sobrien
57948114Sobrien        LOG_NFACILITIES = 24,  /* current number of facilities */
58048114Sobrien    }
58148114Sobrien
58247133Sobrien    int LOG_MASK(int pri) { return 1 << pri; }        /* mask for one priority */
58347136Sobrien    int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; }  /* all priorities through pri */
58448114Sobrien
58548114Sobrien    void openlog (const char *, int __option, int __facility);
58648114Sobrien    int  setlogmask (int __mask);
58748114Sobrien    void syslog (int __pri, const char *__fmt, ...);
58848114Sobrien    void closelog();
58948114Sobrien}
59047136Sobrien