syslog.h(0P)

πŸ¦‹ syslog.h(0P) β€” POSIX Programmer's Manual, bestie edition πŸ’…

okay so real talk, this page is from the POSIX Programmer's Manual (syslog.h(0P), the 0P is giving very POSIX-coded). but heads up before we go any further: the Linux implementation of this interface may differ β€” so pls consult the corresponding Linux manual page for the deets on Linux behavior. also it's possible this interface just… isn't implemented on Linux at all. 😭 vibe check accordingly.


✨ PROLOG ✨

so like, this manual page is part of the POSIX Programmer's Manual, fr fr. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. that's the whole disclaimer, love that for us.


πŸŽ€ NAME πŸŽ€

syslog.h β€” definitions for system error logging. yes bestie, it's THE header for when your programs need to scream into the void (the void being the system log). iconic behavior honestly.


🌸 SYNOPSIS 🌸

#include <syslog.h>

that's it. one include. slay.


πŸ’– DESCRIPTION πŸ’–

The <syslog.h> header shall define the following symbolic constants, zero or more of which may be OR'ed together to form the logopt option of openlog(). (zero or more! so you can stack them like friendship bracelets 🫢)

  • LOG_PID β€” Log the process ID with each message. so you know which little guy did the thing.
  • LOG_CONS β€” Log to the system console on error. going straight to the big screen, main character energy.
  • LOG_NDELAY β€” Connect to syslog daemon immediately. no waiting, we're impatient and that's valid.
  • LOG_ODELAY β€” Delay open until syslog() is called. the slow burn approach.
  • LOG_NOWAIT β€” Do not wait for child processes. we do not babysit here.

🌈 facility constants (for the facility argument to openlog()) 🌈

The <syslog.h> header shall define the following symbolic constants for use as the facility argument to openlog():

  • LOG_KERN β€” Reserved for message generated by the system.
  • LOG_USER β€” Message generated by a process. (that's you! hi!)
  • LOG_MAIL β€” Reserved for message generated by mail system.
  • LOG_NEWS β€” Reserved for message generated by news system.
  • LOG_UUCP β€” Reserved for message generated by UUCP system.
  • LOG_DAEMON β€” Reserved for message generated by system daemon.
  • LOG_AUTH β€” Reserved for message generated by authorization daemon.
  • LOG_CRON β€” Reserved for message generated by clock daemon.
  • LOG_LPR β€” Reserved for message generated by printer system.
  • LOG_LOCAL0 β€” Reserved for local use.
  • LOG_LOCAL1 β€” Reserved for local use.
  • LOG_LOCAL2 β€” Reserved for local use.
  • LOG_LOCAL3 β€” Reserved for local use.
  • LOG_LOCAL4 β€” Reserved for local use.
  • LOG_LOCAL5 β€” Reserved for local use.
  • LOG_LOCAL6 β€” Reserved for local use.
  • LOG_LOCAL7 β€” Reserved for local use.

(seven whole LOG_LOCAL slots just vibing there for you to use however you want, no cap πŸ’œ)


🧚 priority mask macros (for the maskpri argument to setlogmask()) 🧚

The <syslog.h> header shall define the following macros for constructing the maskpri argument to setlogmask(). The following macros expand to an expression of type int when the argument pri is an expression of type int:

  • LOG_MASK(pri) β€” A mask for priority pri.

⭐ priority constants (for the priority argument of syslog()) ⭐

The <syslog.h> header shall define the following symbolic constants for use as the priority argument of syslog():

  • LOG_EMERG β€” A panic condition was reported to all processes. 🚨 everything is on fire, tell everyone.
  • LOG_ALERT β€” A condition that should be corrected immediately. like RIGHT now bestie.
  • LOG_CRIT β€” A critical condition.
  • LOG_ERR β€” An error message.
  • LOG_WARNING β€” A warning message.
  • LOG_NOTICE β€” A condition requiring special handling.
  • LOG_INFO β€” A general information message.
  • LOG_DEBUG β€” A message useful for debugging programs. the little guys that only matter when things break.

🫢 the functions 🫢

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

void  closelog(void);
void  openlog(const char *, int, int);
int   setlogmask(int);
void  syslog(int, const char *, ...);
⚠️ note the "may also be defined as macros" thing β€” so don't go doing anything cursed like taking their address, okay? just call them normally like a well-behaved legend. πŸ’…

πŸ“ informative sections πŸ“

The following sections are informative.


πŸ™ˆ APPLICATION USAGE πŸ™ˆ

None.

(genuinely nothing. the void. we stan a low-effort section.)


πŸ’€ RATIONALE πŸ’€

None.

(again β€” nothing! they really said "no thoughts, head empty" 😭)


🌈 FUTURE DIRECTIONS 🌈

None.

(no dramatic future plans, it's giving stable.)


πŸ”₯ SEE ALSO πŸ”₯

The System Interfaces volume of POSIX.1‐2017, closelog()


Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie, mwah πŸ’‹

this lil masterpiece comes to you courtesy of IEEE/The Open Group, dated 2017, filed under syslog.h(0P). go forth and log responsibly, queen. πŸŽ€βœ¨

πŸ“¦ where this page comes from