This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interface to the POSIX System logger interface.
- Loading branch information
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* D header file to interface with the Linux system logger API | ||
* (http://man7.org/linux/man-pages/man3/syslog.3.html) | ||
* (http://pubs.opengroup.org/onlinepubs/007904875/basedefs/syslog.h.html) | ||
* | ||
* Copyright: Copyright Adil Baig 2013. | ||
* License : $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) | ||
* Authors : Adil Baig (github.com/adilbaig) | ||
*/ | ||
module std.syslog; | ||
|
||
version (Posix): | ||
|
||
extern (C): | ||
@system: | ||
nothrow: | ||
|
||
//PRIORITY | ||
enum { | ||
LOG_EMERG = 0, /* system is unusable */ | ||
LOG_ALERT = 1, /* action must be taken immediately */ | ||
LOG_CRIT = 2, /* critical conditions */ | ||
LOG_ERR = 3, /* error conditions */ | ||
LOG_WARNING = 4, /* warning conditions */ | ||
LOG_NOTICE = 5, /* normal but significant condition */ | ||
LOG_INFO = 6, /* informational */ | ||
LOG_DEBUG = 7, /* debug-level messages */ | ||
}; | ||
|
||
//OPTIONS | ||
enum { | ||
LOG_PID = 0x01, /* log the pid with each message */ | ||
LOG_CONS = 0x02, /* log on the console if errors in sending */ | ||
LOG_ODELAY = 0x04, /* delay open until first syslog() (default) */ | ||
LOG_NDELAY = 0x08, /* don't delay open */ | ||
LOG_NOWAIT = 0x10, /* don't wait for console forks: DEPRECATED */ | ||
LOG_PERROR = 0x20, /* log to stderr as well */ | ||
}; | ||
|
||
//FACILITY | ||
enum { | ||
LOG_KERN = (0<<3), /* kernel messages */ | ||
LOG_USER = (1<<3), /* random user-level messages */ | ||
LOG_MAIL = (2<<3), /* mail system */ | ||
LOG_DAEMON = (3<<3), /* system daemons */ | ||
LOG_AUTH = (4<<3), /* security/authorization messages */ | ||
LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ | ||
LOG_LPR = (6<<3), /* line printer subsystem */ | ||
LOG_NEWS = (7<<3), /* network news subsystem */ | ||
LOG_UUCP = (8<<3), /* UUCP subsystem */ | ||
LOG_CRON = (9<<3), /* clock daemon */ | ||
LOG_AUTHPRIV = (10<<3), /* security/authorization messages (private), */ | ||
LOG_FTP = (11<<3), /* ftp daemon */ | ||
|
||
/* other codes through 15 reserved for system use */ | ||
LOG_LOCAL0 = (16<<3), /* reserved for local use */ | ||
LOG_LOCAL1 = (17<<3), /* reserved for local use */ | ||
LOG_LOCAL2 = (18<<3), /* reserved for local use */ | ||
LOG_LOCAL3 = (19<<3), /* reserved for local use */ | ||
LOG_LOCAL4 = (20<<3), /* reserved for local use */ | ||
LOG_LOCAL5 = (21<<3), /* reserved for local use */ | ||
LOG_LOCAL6 = (22<<3), /* reserved for local use */ | ||
LOG_LOCAL7 = (23<<3), /* reserved for local use */ | ||
|
||
LOG_NFACILITIES = 24, /* current number of facilities */ | ||
}; | ||
|
||
int LOG_MASK(int pri) { return 1 << pri; } /* mask for one priority */ | ||
int LOG_UPTO(int pri) { return (1 << (pri+1)) - 1; } /* all priorities through pri */ | ||
|
||
void openlog (const char *__ident, int __option, int __facility); | ||
int setlogmask (int __mask); | ||
void syslog (int __pri, const char *__fmt, ...); | ||
void closelog(); |