pappl-log(3) pappl logging functions pappl-log(3)

pappl-log - pappl logging functions

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

#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, ...);

The PAPPL logging functions record messages to the configured log file.

papplLog records messages applying to the system as a whole.

papplLogClient, papplLogJob, and papplLogPrinter record messages specific to a client connection, print job, or printer respectively.

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.

The message argument specifies the message using a printf(3) format string.

Log levels


Debug message

Error message

Fatal message

Informational message

Not specified

Warning message

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.

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.

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.

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.

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.

Log levels

typedef enum pappl_loglevel_e pappl_loglevel_t;

pappl(1), pappl-client(3), pappl-device(3), pappl-job(3), pappl-log(3), pappl-mainline(3), pappl-makeresheader(1), pappl-printer(3), pappl-resource(3), pappl-system(3), https://www.msweet.org/pappl

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.

pappl logging functions 2024-01-22