Skip to content
David Hill edited this page Jul 18, 2013 · 1 revision

clog (Copious Logger) is a library that provides various logging services. It can be used to log information to syslog or stderr at various levels of verbosenes. The user can define his/her own debug/verbosity flags to, at runtime, determine how verbose an application or daemon is.

Installation

On OpenBSD:

make obj
make depend
make
sudo make install

Example Use

        clog_init(1);

        if (clog_set_flags(CLOG_F_FILE | CLOG_F_FUNC | CLOG_F_LINE |
            CLOG_F_STDERR | CLOG_F_ENABLE | CLOG_F_DTIME))
                errx(1, "can't set clog flags");
        clog_set_mask(CLOGTEST_F_LEVEL1 | CLOGTEST_F_LEVEL2);

        CNDBG(CLOGTEST_F_LEVEL3, "not printed %s", "meh");
        CNDBG(CLOGTEST_F_LEVEL1, "printed %s", "meh");
        CDBG("dbg too %s", "DBG");

        if (clog_set_flags(CLOG_F_STDERR | CLOG_F_ENABLE | CLOG_F_DTIME | CLOG_F_DATE))
                errx(1, "can't clear clog flags");

        CNDBG(1, "moo %s", "meh");
        CDBG("dbg2 too %s", "feh");

        if (clog_set_flags(CLOG_F_STDERR | CLOG_F_ENABLE | CLOG_F_DATE | CLOG_F_SYSLOG | CLOG_F_DBGENABLE))
                errx(1, "can't clear clog flags");

        CNDBG(1, "bah %s", "lah");
        CDBG("dbg 3 too %s", "foo");

        CWARNX("OHNOES WARNING");
        CWARN("OHNOES WARNING with errno");
        CNFATAL(CLOGTEST_F_LEVEL3, "OHNOES FATAL");

        /* not reached */
        CWARNX("OHNOES WARNING not reached");

clog resources

  • Forum
  • Bug tracker
  • viewgit
  • manpage
  • Snapshots.
  • Mailing lists
    • clog-commits
      • subscribe: email clog-commits+subscribe at opensource.conformal.com
      • unsubscribe: email clog-commits+unsubscribe at opensource.conformal.com
  • Anonymous source is available via one of the following:
    • git clone git://github.com/conformal/clog.git
    • git clone https://github.com/conformal/clog.git
Clone this wiki locally