diff options
Diffstat (limited to 'share/man/man9/printf.9')
-rw-r--r-- | share/man/man9/printf.9 | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/share/man/man9/printf.9 b/share/man/man9/printf.9 index b3b3189..8a8d340 100644 --- a/share/man/man9/printf.9 +++ b/share/man/man9/printf.9 @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2001 Andrew R. Reiter +.\" Copyritht (c) 2004 Joerg Wunsch .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,11 +26,11 @@ .\" .\" $FreeBSD$ .\" -.Dd April 25, 2001 +.Dd August 10, 2004 .Dt PRINTF 9 .Os .Sh NAME -.Nm printf , uprintf , tprintf +.Nm printf , uprintf , tprintf, log .Nd formatted output conversion .Sh SYNOPSIS .In sys/types.h @@ -40,13 +41,15 @@ .Fn tprintf "struct proc *p" "int pri" "const char *fmt" "..." .Ft int .Fn uprintf "const char *fmt" "..." +.Ft void +.Fn log "int pri" "const char *fmt" "..." .Sh DESCRIPTION The .Xr printf 9 family of functions are similar to the .Xr printf 3 family of functions. -The three functions each use a different output stream. +The different functions each use a different output stream. The .Fn uprintf function outputs to the current process' controlling tty, while @@ -59,6 +62,11 @@ function outputs to the tty associated with the process and the logging facility if .Fa pri is not \&-1. +The +.Fn log +function sends the message to the kernel logging facility, using +the log level as indicated by +.Fa pri . .Pp Each of these related functions use the .Fa fmt @@ -102,6 +110,28 @@ a time. The string is used as a delimiter between individual bytes. If present, a width directive will specify the number of bytes to display. By default, 16 bytes of data are output. +.Pp +The +.Fn log +function uses +.Xr syslog 3 +level values +.Dv LOG_DEBUG +through +.Dv LOG_EMERG +for its +.Fa pri +parameter (mistakenly called +.Sq priority +here). +Alternatively, if a +.Fa pri +of \&-1 is given, the message will be appended to the last log message +started by a previous call to +.Fn log . +As these messages are generated by the kernel itself, the facility will +always be +.Dv LOG_KERN . .Sh RETURN VALUES The .Fn printf @@ -126,5 +156,15 @@ will produce the following output: reg=3<BITTWO,BITONE> out: 41:41:41:41 .Ed +.Pp +The call +.Bd -literal -offset indent +log(LOG_DEBUG, "%s%d: been there.\\n", sc->sc_name, sc->sc_unit); +.Ed +.Pp +will add the appropriate debug message at priority +.Em kern.debug +to the system log. .Sh SEE ALSO -.Xr printf 3 +.Xr printf 3 , +.Xr syslog 3 |