zlog(3)

zlog(3)

CZMQ Manual - CZMQ/3.0.0

Name

zlog - logging class

Synopsis

//  Constructor; the sender name is prepended to every message, and may
//  not be null.
CZMQ_EXPORT zlog_t *
    zlog_new (const char *sender);

//  Destructor
CZMQ_EXPORT void
    zlog_destroy (zlog_t **self_p);

//  Set foreground logging on/off. By default, this is off on systems that
//  can do background logging using syslog, and on for systems without syslog
//  support.
CZMQ_EXPORT void
    zlog_set_foreground (zlog_t *self, bool foreground);

//  Log error condition - highest priority
CZMQ_EXPORT void
    zlog_error (zlog_t *self, const char *format, ...);

//  Log warning condition - high priority
CZMQ_EXPORT void
    zlog_warning (zlog_t *self, const char *format, ...);

//  Log normal, but significant, condition - normal priority
CZMQ_EXPORT void
    zlog_notice (zlog_t *self, const char *format, ...);

//  Log informational message - low priority
CZMQ_EXPORT void
    zlog_info (zlog_t *self, const char *format, ...);

//  Log debug-level message - lowest priority
CZMQ_EXPORT void
    zlog_debug (zlog_t *self, const char *format, ...);

//  Self test of this class
CZMQ_EXPORT void 
    zlog_test (bool verbose);

Description

Wraps the syslog API in a portable framework. On platforms without syslog, sends output to the console.

Example

From zlog_test method

    zlog_t *log = zlog_new ("zlog_test");
    assert (log);
    zlog_error   (log, "%s", "My pizza was stolen!");
    zlog_warning (log, "%s", "My pizza is late :(");
    zlog_notice  (log, "%s", "My pizza arrived on time");
    zlog_info    (log, "%s", "My pizza smells great!");
    zlog_debug   (log, "%s", "My pizza is round and flat");
    if (verbose) {
        zlog_set_foreground (log, true);
        zlog_notice (log, "%s", "My pizza arrived on time");
    } 
    zlog_destroy (&log);

See also

czmq(7)

Authors

The CZMQ manual was written by Pieter Hintjens<moc.xitami|hp#moc.xitami|hp>.

Resources

Main web site: http://czmq.zeromq.org/

Report bugs to the ØMQ development mailing list: <gro.qmorez.stsil|ved-qmorez#gro.qmorez.stsil|ved-qmorez>

Copyright

Copyright (c) the Contributors as noted in the AUTHORS file. This file is part of CZMQ, the high-level C binding for ØMQ: http://czmq.zeromq.org. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.