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