xref: /openbmc/ipmitool/include/ipmitool/log.h (revision c18ec02f)
1 /*
2  * Copyright (c) 2003 Sun Microsystems, Inc.  All Rights Reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistribution of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistribution in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * Neither the name of Sun Microsystems, Inc. or the names of
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * This software is provided "AS IS," without a warranty of any kind.
20  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
21  * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
22  * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
23  * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
24  * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
25  * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL
26  * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
27  * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
28  * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
29  * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
30  * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
31  */
32 
33 #ifndef IPMITOOL_LOG_H
34 #define IPMITOOL_LOG_H
35 
36 #include <syslog.h>
37 
38 /* sys/syslog.h:
39  * LOG_EMERG       0       system is unusable
40  * LOG_ALERT       1       action must be taken immediately
41  * LOG_CRIT        2       critical conditions
42  * LOG_ERR         3       error conditions
43  * LOG_WARNING     4       warning conditions
44  * LOG_NOTICE      5       normal but significant condition
45  * LOG_INFO        6       informational
46  * LOG_DEBUG       7       debug-level messages
47  */
48 
49 #define LOG_ERROR		LOG_ERR
50 #define LOG_WARN		LOG_WARNING
51 
52 #define LOG_NAME_DEFAULT	"ipmitool"
53 #define LOG_MSG_LENGTH		1024
54 
55 void log_init(const char * name, int isdaemon, int verbose);
56 void log_halt(void);
57 void log_level_set(int level);
58 int log_level_get(void);
59 void lprintf(int level, const char * format, ...);
60 void lperror(int level, const char * format, ...);
61 
62 #endif /*IPMITOOL_LOG_H*/
63 
64