xref: /titanic_41/usr/src/cmd/ssh/include/log.h (revision e11c3f44f531fdff80941ce57c065d2ae861cefc)
1 /*
2  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 /*	$OpenBSD: log.h,v 1.8 2002/07/19 15:43:33 markus Exp $	*/
6 
7 #ifndef	_LOG_H
8 #define	_LOG_H
9 
10 #pragma ident	"%Z%%M%	%I%	%E% SMI"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 
17 /*	$OpenBSD: log.h,v 1.8 2002/07/19 15:43:33 markus Exp $	*/
18 
19 /*
20  * Author: Tatu Ylonen <ylo@cs.hut.fi>
21  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
22  *                    All rights reserved
23  *
24  * As far as I am concerned, the code I have written for this software
25  * can be used freely for any purpose.  Any derived versions of this
26  * software must be clearly marked as such, and if the derived work is
27  * incompatible with the protocol description in the RFC file, it must be
28  * called by a name other than "ssh" or "Secure Shell".
29  */
30 
31 #include <syslog.h> /* Needed for LOG_AUTHPRIV (if present) */
32 
33 /* Supported syslog facilities and levels. */
34 typedef enum {
35 	SYSLOG_FACILITY_DAEMON,
36 	SYSLOG_FACILITY_USER,
37 	SYSLOG_FACILITY_AUTH,
38 #ifdef LOG_AUTHPRIV
39 	SYSLOG_FACILITY_AUTHPRIV,
40 #endif
41 	SYSLOG_FACILITY_LOCAL0,
42 	SYSLOG_FACILITY_LOCAL1,
43 	SYSLOG_FACILITY_LOCAL2,
44 	SYSLOG_FACILITY_LOCAL3,
45 	SYSLOG_FACILITY_LOCAL4,
46 	SYSLOG_FACILITY_LOCAL5,
47 	SYSLOG_FACILITY_LOCAL6,
48 	SYSLOG_FACILITY_LOCAL7,
49 	SYSLOG_FACILITY_NOT_SET = -1
50 }       SyslogFacility;
51 
52 typedef enum {
53 	SYSLOG_LEVEL_QUIET,
54 	SYSLOG_LEVEL_FATAL,
55 	SYSLOG_LEVEL_ERROR,
56 	SYSLOG_LEVEL_NOTICE,
57 	SYSLOG_LEVEL_INFO,
58 	SYSLOG_LEVEL_VERBOSE,
59 	SYSLOG_LEVEL_DEBUG1,
60 	SYSLOG_LEVEL_DEBUG2,
61 	SYSLOG_LEVEL_DEBUG3,
62 	SYSLOG_LEVEL_NOT_SET = -1
63 }       LogLevel;
64 
65 void     log_init(char *, LogLevel, SyslogFacility, int);
66 
67 SyslogFacility	log_facility_number(char *);
68 LogLevel log_level_number(char *);
69 
70 void	 set_log_txt_prefix(const char *);
71 void     fatal(const char *, ...) __attribute__((format(printf, 1, 2)));
72 void     error(const char *, ...) __attribute__((format(printf, 1, 2)));
73 void     notice(const char *, ...) __attribute__((format(printf, 1, 2)));
74 void     log(const char *, ...) __attribute__((format(printf, 1, 2)));
75 void     verbose(const char *, ...) __attribute__((format(printf, 1, 2)));
76 void     debug(const char *, ...) __attribute__((format(printf, 1, 2)));
77 void     debug2(const char *, ...) __attribute__((format(printf, 1, 2)));
78 void     debug3(const char *, ...) __attribute__((format(printf, 1, 2)));
79 
80 void     fatal_cleanup(void);
81 void     fatal_add_cleanup(void (*) (void *), void *);
82 void     fatal_remove_cleanup(void (*) (void *), void *);
83 void     fatal_remove_all_cleanups(void);
84 
85 void	 do_log(LogLevel, const char *, va_list);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif /* _LOG_H */
92