summaryrefslogtreecommitdiff
path: root/man/x.html
blob: 224edc1260e526b13d80c9899661273f00d5c6c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<HTML>
<BODY>
<PRE>
<!-- Manpage converted by man2html 3.0.1 -->
SYNTAX
       #include "logmsg.h"

       int logmsg(const char *who, int ecode, unsigned int classs, char *msg)

       err_sys(w,e) logmsg(w,e,FATAL,"")
       err_sys_plus(w,e,m) logmsg(w,e,FATAL,m)
       err_tmp(w,e) logmsg(w,e,WARN,"")
       err_tmp_plus(w,e,m) logmsg(w,e,WARN,m)
       err_int(w,e,c) logmsg(w,e,c,"")
       err_int_plus(w,e,c,m) logmsg(w,e,c,m)
       log_who(w,m) logmsg(w,0,LOG,m)
       log_anon(m) logmsg("",0,LOG,m)

DESCRIPTION
       logmsg  prints  error,  warning, or info/logging messages to stderr and
       potentially terminates the calling  program,  depending  on  the  class
       given.   who  is the name of the program, ecode is an error code, class
       determines the behavior upon call and msg is the logging message.  Read
       "error.h" to learn more about related constants.

ECODE
       ecode is the error code and subject to be displayed in the log file and
       potentially used upon exit if the class equals ERROR, FATAL, or DROP.

       To avoid conflicts with syscall error codes, appplication defined error
       codes  should  be negative.  The values -15, -100 and -111 are reserved
       for backward compatibility.

CLASS
       The class parameter indicates how the  application  handles  exceptions
       and displays the log message.

       o   LOG, INFO, ALERT, WARN - display message and continue operation

       o   DROP  - display warning message and continue while returning to the
           calling program

       o   USAGE, SYNTAX, FATAL, ERROR - display error message and exit appli‐
           cation with error code

       INFO,  ALERT, WARN, DROP, USAGE, and FATAL as well as ERROR display the
       respective class string like warning: in the  log  message,  while  LOG
       shows the log message only.

       The  class FATAL should be used for system error codes only, rather ER‐
       ROR and WARN shall be  set  in  conjunction  with  an  application  er‐
       ror/warning.

MESSAGE
       If the custom message msg is given, it will be printed additionally.

       Dan  Bernstein  used sets of strerr_dieY*() and strerr_warnY() messages
       which explicitely determine the  message  and  behavior  class.   Other
       classes were occasionally defined on demand, such als usage().

       Kai  Peter introduced the errmsg facility in his qlibs including a sys‐
       log compliant severity as second parameter.

EXAMPLES
       The macro definitions uses  w for the  calling  program,  e  for  error
       code, c for class, and m for message.

         #include "logmsg.h"
         #define WHO "my_prog"

         err_sys(WHO,errno);
         err_sys_plus(WHO,-111,"additional message");

         err_tmp("",-100);
         err_tmp_plus("",errno,"additional message");

         log_who(WHO,"message");

       log_anon() is like log_who() but doesn't print the caller name.

       An user defined message s can be build from multiple arguments by using
       the B (build) macro:

         err_sys_plus((errno),B("unable to run: ",*argv));

SEE ALSO
       <B>syslog(3)</B>



                                       3                        qlibs:(logmsg)
</PRE>
<HR>
<ADDRESS>
Man(1) output converted with
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</ADDRESS>
</BODY>
</HTML>