*BSD News Article 98116


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!sol.net!spool.mu.edu!newsspool.sol.net!howland.erols.net!newsfeed.nacamar.de!fu-berlin.de!irz401!orion.sax.de!uriah.heep!news
From: j@uriah.heep.sax.de (J Wunsch)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: kernel traces
Date: 20 Jun 1997 06:51:58 GMT
Organization: Private BSD site, Dresden
Lines: 41
Message-ID: <5od9ae$594@uriah.heep.sax.de>
References: <5o9e5r$1ar@delphi.cs.ucla.edu> <5ob3j1$2ro@ui-gate.utell.co.uk>
Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
NNTP-Posting-Host: localhost.heep.sax.de
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: knews 0.9.6
X-Phone: +49-351-2012 669
X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F  93 21 E0 7D F9 12 D6 4E
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:43223

brian@shift.utell.net (Brian Somers) wrote:

> I use printf() - stuff comes out on the console.  I've never needed to
> find out how this is driven, but I suspect it routes through klog().

Since i redirect kernel messages of sufficiently high level to all my
logged in ttys, the printfs usually bother me too much.  Thus, i
recently converted the sppp stuff (while working at it) to use log(9).
Perhaps time to write a man page...

SYNOPSIS

	#include <sys/syslog.h>
	#include <sys/systm.h>

	void
	log(int level, const char *fmt, ...);

	int
	addlog(const char *fmt, ...);

DESCRIPTION

The function log() passes a message to the syslog facility, using the
specified level (always in the kernel facility).  The message is
formatted according to fmt, similar as in printf(9).

The function addlog() adds more messages to the syslog facility, using
the same level that has been previously selected using log(9).  Be
careful to only use it in a code path where the log level could not
have been modified between the respective function calls.

The log functions guarantee not to sleep, thus are safe to be used
inside interrupt routines.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)