zlog(3)

zlog(3)

CZMQ Manual - CZMQ/2.2.1

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 int
    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) 1991-2014 iMatix and Contributors. License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>. This is free software: you are free to change it and redistribute it. There is NO WARRANTY, to the extent permitted by law. For details see the files COPYING and COPYING.LESSER included with the CZMQ distribution.