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