sysfatal.3 (1427B)
1 .TH SYSFATAL 3 2 .SH NAME 3 syslog, sysfatal \- system error messages 4 .SH SYNOPSIS 5 .B #include <u.h> 6 .br 7 .B #include <libc.h> 8 .PP 9 .B 10 void syslog(int cons, char *logname, char *fmt, ...) 11 .PP 12 .B 13 void sysfatal(char *fmt, ...) 14 .SH DESCRIPTION 15 .I Sysfatal 16 prints to standard error the name of the running program, 17 a colon and a space, 18 the message described by the 19 .MR print (3) 20 format string 21 .I fmt 22 and subsequent arguments, and a newline. 23 It then calls 24 .MR exits (3) 25 with the formatted message as argument. 26 The program's name is the value of 27 .BR argv0 , 28 which will be set if the program uses the 29 .MR arg (3) 30 interface to process its arguments. 31 If 32 .B argv0 33 is null, it is ignored and the following colon and space are suppressed. 34 .PP 35 .I Syslog 36 logs messages in the file named by 37 .I logname 38 in the directory 39 .B \*9/log ; 40 the file must already exist and is opened append-only. 41 .I Logname 42 must contain no slashes. 43 The message is a line with several fields: 44 the name of the machine writing the message; 45 the date and time; 46 the message specified by the 47 .MR print (3) 48 format 49 .I fmt 50 and any following arguments; 51 and a final newline. 52 If 53 .I cons 54 is set or the log file cannot be opened, the message is also printed 55 on the system console. 56 .I Syslog 57 can be used safely in multi-threaded programs. 58 .SH SOURCE 59 .B \*9/src/lib9/sysfatal.c 60 .br 61 .B \*9/src/lib9/syslog.c 62 .SH "SEE ALSO" 63 .MR intro (3) , 64 .MR errstr (3) , 65 the 66 .B %r 67 format in 68 .MR print (3)