Personal tools
Namespaces

Variants
Actions

Category:Libniftylog

From NiftyWiki
Jump to: navigation, search
Home Documentation Download Support Showroom Links
lightweight & simple library to implement logging/debugging output for new or existing applications Flattr-badge-large.png


Features

  • log-mechanisms (stderr, syslog, file, tty, ...)
  • different loglevels
  • set loglevel by API call or using environment variables
  • various convenience macros


Abstract

Libniftylog could not be simpler. It was made to re-use common code easier and quicker. It's a seperate library so multiple projects benefit from updates, improvements and new features.


Installation

Home Documentation Download Support Showroom Links

Debian

If not done, yet:

  • import archive key (Fingerprint: 895D 8086 8FEF 100C DA82 0393 16CC 4680 AA46 5E22):
wget -qO - http://debian.niftylight.de/archive.key | sudo apt-key add -
  • register niftylight package source in /etc/apt/sources.list:
deb http://debian.niftylight.de/ unstable main
deb-src http://debian.niftylight.de/ unstable main
  • update
sudo apt-get update


to install, run:

sudo apt-get install libniftylog


Gentoo

Emerge layman if you don't have it already.

emerge -va layman

Add the niftyled overlay (if you don't have already)

layman -f -o http://gentoo.niftylight.de/layman.xml -a niftyled

Emerge:

emerge --autounmask-write niftylog


Build manually

Prerequisites

to compile from sources:

  • compiler e.g. gcc
  • autotools (autoconf, autoheader, ...)

to run:

  • *nix OS


Get sources

Git: git clone git://github.com/niftylight/niftylog.git
ZIP-Archive: https://github.com/niftylight/niftylog/zipball/master
Browse: github.com.


Compile

If your OS doesn't include the default install prefix, you might have to do that yourself before compiling:

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
export LD_LIBRARY_PATH="/usr/local/lib"
export PATH="${PATH}:/usr/local/bin"


to compile & install, cd into the source directory and run:

autoreconf -is
mkdir build
cd build
../configure
make
sudo make install


If you don't want to install to the default location (/usr/local), you can choose a different install prefix, e.g.:

./configure --prefix=/usr


To freshly rebuild a previously built tree, do (you can skip this if you just checked out the sources):

make maintainer-clean
or just remove all contents of the build directory and repeat the previous steps.


See additional compile time options by running:

./configure --help


Development

add

#include "<niftylog.h>"

to your source and compile like:

gcc -o yourprog yourprog.c `pkg-config --cflags --libs niftylog`


Usage

Every libniftylog application can use various environment variables:

name example description
NFT_LOG_MECHANISM NFT_LOG_MECHANISM="stderr" Set logging mechanism. For a list of available mechanisms use NFT_LOG_MECHANISM="list" or s. mechanism.c sourcecode
NFT_LOG_LEVEL NFT_LOG_LEVEL="debug" Set loglevel. For a list of available log levels check the NftLoglevel section in the doxygen documentation. A list of available loglevels should also be printed in the --help text of applications.
NFT_LOG_IDENT NFT_LOG_IDENT="myapp" Set identity for log mechanisms that support it (e.g. syslog)


Further documentation


Issues

Please report anything via the issue tracker.


Changes

This category currently contains no pages or media.