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