1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-09 22:38:01 +00:00
sgminer/logging.h
zefir e0fec35751 modularized logging, support for priority based logging
Functions related to logging are extracted into dedicated source files
for better maintainability.

The existing low-level logging API is extended with a generalized scheme
providing log functions log_{error, warning, notice, info, debug} that
log messages based on a global opt_log_level.

opt_log_level for now is set to LOG_NOTICE and might be modified via
command line options or config files in future releases.
2012-02-11 20:26:25 +01:00

39 lines
900 B
C

#ifndef __LOGGING_H__
#define __LOGGING_H__
#include "config.h"
#include <stdbool.h>
#include <stdarg.h>
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#else
enum {
LOG_ERR,
LOG_WARNING,
LOG_NOTICE,
LOG_INFO,
LOG_DEBUG,
};
#endif
/* original / legacy debug flags */
extern bool opt_debug;
extern bool opt_log_output;
/* global log_level, messages with lower or equal prio are logged */
extern int opt_log_level;
/* low-level logging functions with priority parameter */
extern void vapplog(int prio, const char *fmt, va_list ap);
extern void applog(int prio, const char *fmt, ...);
/* high-level logging functions with implicit priority */
extern void log_error(const char *fmt, ...);
extern void log_warning(const char *fmt, ...);
extern void log_notice(const char *fmt, ...);
extern void log_info(const char *fmt, ...);
extern void log_debug(const char *fmt, ...);
#endif /* __LOGGING_H__ */