=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/log.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- src/usr.bin/ssh/log.h 2019/09/06 04:53:27 1.24 +++ src/usr.bin/ssh/log.h 2020/10/16 13:24:45 1.25 @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.24 2019/09/06 04:53:27 djm Exp $ */ +/* $OpenBSD: log.h,v 1.25 2020/10/16 13:24:45 djm Exp $ */ /* * Author: Tatu Ylonen @@ -45,36 +45,57 @@ SYSLOG_LEVEL_NOT_SET = -1 } LogLevel; -typedef void (log_handler_fn)(LogLevel, const char *, void *); +typedef void (log_handler_fn)(const char *, const char *, int, LogLevel, + const char *, void *); void log_init(char *, LogLevel, SyslogFacility, int); LogLevel log_level_get(void); int log_change_level(LogLevel); int log_is_on_stderr(void); void log_redirect_stderr_to(const char *); +void log_verbose_add(const char *); +void log_verbose_reset(void); SyslogFacility log_facility_number(char *); const char * log_facility_name(SyslogFacility); LogLevel log_level_number(char *); const char * log_level_name(LogLevel); -void fatal(const char *, ...) __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); -void error(const char *, ...) __attribute__((format(printf, 1, 2))); -void sigdie(const char *, ...) __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); -void logdie(const char *, ...) __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); -void logit(const char *, ...) __attribute__((format(printf, 1, 2))); -void verbose(const char *, ...) __attribute__((format(printf, 1, 2))); -void debug(const char *, ...) __attribute__((format(printf, 1, 2))); -void debug2(const char *, ...) __attribute__((format(printf, 1, 2))); -void debug3(const char *, ...) __attribute__((format(printf, 1, 2))); - - void set_log_handler(log_handler_fn *, void *); -void do_log2(LogLevel, const char *, ...) - __attribute__((format(printf, 2, 3))); -void do_log(LogLevel, const char *, va_list); void cleanup_exit(int) __attribute__((noreturn)); + +void sshlog(const char *, const char *, int, int, + LogLevel, const char *, ...) __attribute__((format(printf, 6, 7))); +void sshlogv(const char *, const char *, int, int, + LogLevel, const char *, va_list); +void sshsigdie(const char *, const char *, int, const char *, ...) + __attribute__((noreturn)) __attribute__((format(printf, 4, 5))); +void sshlogdie(const char *, const char *, int, const char *, ...) + __attribute__((noreturn)) __attribute__((format(printf, 4, 5))); +void sshfatal(const char *, const char *, int, const char *, ...) + __attribute__((noreturn)) __attribute__((format(printf, 4, 5))); + +#define ssh_nlog(level, ...) sshlog(__FILE__, __func__, __LINE__, 0, level, __VA_ARGS__) +#define ssh_debug3(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_DEBUG3, __VA_ARGS__) +#define ssh_debug2(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_DEBUG2, __VA_ARGS__) +#define ssh_debug(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_DEBUG1, __VA_ARGS__) +#define ssh_verbose(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_VERBOSE, __VA_ARGS__) +#define ssh_log(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_INFO, __VA_ARGS__) +#define ssh_error(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_ERROR, __VA_ARGS__) +#define ssh_fatal(...) sshfatal(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define ssh_logdie(...) sshlogdie(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define ssh_sigdie(...) sshsigdie(__FILE__, __func__, __LINE__, __VA_ARGS__) + +#define debug ssh_debug +#define debug1 ssh_debug1 +#define debug2 ssh_debug2 +#define debug3 ssh_debug3 +#define error ssh_error +#define logit ssh_log +#define verbose ssh_verbose +#define fatal ssh_fatal +#define logdie ssh_logdie +#define sigdie ssh_sigdie +#define do_log2 ssh_nlog + #endif