pappl-log(3)

✨ pappl-log β€” the logging bestie of libpappl ✨

okay so. you're out here writing a printer application with PAPPL and you need your code to say things into a log file, right? that's literally this whole manual page, bestie. pappl-log(3) is the family of functions that write messages into your configured log file, and we're gonna go through every single one of them together, no skips, no skimming, periodt. πŸ’–


🌸 LIBRARY 🌸

Printer Application Framework (libpappl, "pkg-config --cflags --libs pappl")

like, that's the whole vibe. link against it, you're in. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <pappl/pappl.h>

void
papplLog(pappl_system_t *system, pappl_loglevel_t level, const char
*message, ...);

void
papplLogClient(pappl_client_t *client, pappl_loglevel_t level, const
char *message, ...);

void
papplLogJob(pappl_job_t *job, pappl_loglevel_t level, const char
*message, ...);

void
papplLogPrinter(pappl_printer_t *printer, pappl_loglevel_t level, const
char *message, ...);

four functions, all variadic, all eating a level and a format string. iconic honestly. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

The PAPPL logging functions record messages to the configured log file. that's the whole job description, and they ate.

papplLog records messages applying to the system as a whole. it's the big-picture one, the main character. πŸ‘‘

papplLogClient, papplLogJob, and papplLogPrinter record messages specific to a client connection, print job, or printer respectively. so like, three little specialists for three little scopes. 🌈

The level argument specifies a log level from debugging (PAPPL_LOGLEVEL_DEBUG) to fatal (PAPPL_LOGLEVEL_FATAL) and is used to determine whether the message is recorded to the log. so the level isn't just decoration, it literally decides if your message makes the cut. vibe check, fr fr. πŸ”₯

The message argument specifies the message using a printf(3) format string. yes bestie, full printf energy, %s and all. ✨


🌟 ENUMERATIONS 🌟

πŸ’œ pappl_loglevel_e β€” Log levels

  • PAPPL_LOGLEVEL_DEBUG β€” Debug message. the "hey i'm just snooping around in here" tier. πŸ”
  • PAPPL_LOGLEVEL_ERROR β€” Error message. something went wrong, be sad about it. 😭
  • PAPPL_LOGLEVEL_FATAL β€” Fatal message. oh no. the worst one. πŸ’€
  • PAPPL_LOGLEVEL_INFO β€” Informational message. just vibing, sharing facts. ✨
  • PAPPL_LOGLEVEL_UNSPEC β€” Not specified. undecided. mysterious. πŸ™ˆ
  • PAPPL_LOGLEVEL_WARN β€” Warning message. heads up bestie, this might get ugly. ⚠️

🧚 FUNCTIONS 🧚

⭐ papplLog β€” Log a message for the system.

void papplLog (
    pappl_system_t *system,
    pappl_loglevel_t level,
    const char *message,
    ...
);

This function sends a message to the system's log file. The "level" argument specifies the urgency of the message:

  • PAPPL_LOGLEVEL_DEBUG: A debugging message.
  • PAPPL_LOGLEVEL_ERROR: An error message.
  • PAPPL_LOGLEVEL_FATAL: A fatal error message.
  • PAPPL_LOGLEVEL_INFO: An informational message.
  • PAPPL_LOGLEVEL_WARN: A warning message.

The "message" argument specifies a printf-style format string. Values logged using the "%c" and "%s" format specifiers are sanitized to not contain control characters. yes bestie, the control characters get scrubbed, no sneaky \n nonsense in your log. 🧼✨

⭐ papplLogClient β€” Log a message for a client.

void papplLogClient (
    pappl_client_t *client,
    pappl_loglevel_t level,
    const char *message,
    ...
);

This function sends a client message to the system's log file. The "level" argument specifies the urgency of the message:

  • PAPPL_LOGLEVEL_DEBUG: A debugging message.
  • PAPPL_LOGLEVEL_ERROR: An error message.
  • PAPPL_LOGLEVEL_FATAL: A fatal error message.
  • PAPPL_LOGLEVEL_INFO: An informational message.
  • PAPPL_LOGLEVEL_WARN: A warning message.

The "message" argument specifies a printf-style format string. Values logged using the "%c" and "%s" format specifiers are sanitized to not contain control characters. same sanitizing deal, every single time. πŸŽ€

⭐ papplLogDevice β€” Log a device error for the system...

void papplLogDevice (
    const char *message,
    void *data
);

This function sends a device error message to the system's log file. note that this one's in the FUNCTIONS crew but not in the SYNOPSIS, so don't come for me, i'm just reporting the facts. πŸ‘€

⭐ papplLogJob β€” Log a message for a job.

void papplLogJob (
    pappl_job_t *job,
    pappl_loglevel_t level,
    const char *message,
    ...
);

This function sends a job message to the system's log file. The "level" argument specifies the urgency of the message:

  • PAPPL_LOGLEVEL_DEBUG: A debugging message.
  • PAPPL_LOGLEVEL_ERROR: An error message.
  • PAPPL_LOGLEVEL_FATAL: A fatal error message.
  • PAPPL_LOGLEVEL_INFO: An informational message.
  • PAPPL_LOGLEVEL_WARN: A warning message.

The "message" argument specifies a printf-style format string. Values logged using the "%c" and "%s" format specifiers are sanitized to not contain control characters. your print jobs get the same glow-up treatment. πŸ–¨οΈπŸ’–

⭐ papplLogPrinter β€” Log a message for a printer.

void papplLogPrinter (
    pappl_printer_t *printer,
    pappl_loglevel_t level,
    const char *message,
    ...
);

This function sends a printer message to the system's log file. The "level" argument specifies the urgency of the message:

  • PAPPL_LOGLEVEL_DEBUG: A debugging message.
  • PAPPL_LOGLEVEL_ERROR: An error message.
  • PAPPL_LOGLEVEL_FATAL: A fatal error message.
  • PAPPL_LOGLEVEL_INFO: An informational message.
  • PAPPL_LOGLEVEL_WARN: A warning message.

The "message" argument specifies a printf-style format string. Values logged using the "%c" and "%s" format specifiers are sanitized to not contain control characters. and yeah, printers too. all four of the printf-style ones sanitize identically, that's just the house style. 🌸


🌈 TYPES 🌈

πŸ’… pappl_loglevel_t β€” Log levels

typedef enum pappl_loglevel_e pappl_loglevel_t;

that's it. that's the type. a little typedef so you don't have to type enum every time. we love a convenience. πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

(yes, pappl-log(3) references itself. she's self-aware. main character energy fr.) πŸ’€βœ¨


Copyright Β© 2019-2022 by Michael R Sweet.

PAPPL is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software (like older versions of CUPS), so it can be used freely in any project you'd like. See the files "LICENSE" and "NOTICE" in the source distribution for more information. so like, go build stuff, it's fine, just read those two files. 🫢


and that's the whole page bestie, you made it to the end, so proud of you. πŸ₯Ή this was pappl-log(3) from the pappl logging functions, dated 2026-08-11. go log something cute, and remember: the level argument is not optional and neither is reading the license. bye bestie!! πŸ’–πŸ¦‹πŸŽ€βœ¨

πŸ“¦ where this page comes from