mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 05:54:19 +00:00
Add a simplelog function that does not log date and time.
This commit is contained in:
parent
a9a51459c7
commit
a6e0b6ed39
20
logging.c
20
logging.c
@ -111,3 +111,23 @@ void _applog(int prio, const char *str, bool force)
|
||||
my_log_curses(prio, datetime, str, force);
|
||||
}
|
||||
}
|
||||
|
||||
void _simplelog(int prio, const char *str, bool force)
|
||||
{
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
if (use_syslog) {
|
||||
syslog(prio, "%s", str);
|
||||
}
|
||||
#else
|
||||
if (0) {}
|
||||
#endif
|
||||
else {
|
||||
/* Only output to stderr if it's not going to the screen as well */
|
||||
if (!isatty(fileno((FILE *)stderr))) {
|
||||
fprintf(stderr, "%s\n", str); /* atomic write to stderr */
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
my_log_curses(prio, "", str, force);
|
||||
}
|
||||
}
|
||||
|
11
logging.h
11
logging.h
@ -31,6 +31,7 @@ extern int opt_log_show_date;
|
||||
#define LOGBUFSIZ 256
|
||||
|
||||
extern void _applog(int prio, const char *str, bool force);
|
||||
extern void _simplelog(int prio, const char *str, bool force);
|
||||
|
||||
#define IN_FMT_FFL " in %s %s():%d"
|
||||
|
||||
@ -44,6 +45,16 @@ extern void _applog(int prio, const char *str, bool force);
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define simplelog(prio, fmt, ...) do { \
|
||||
if (opt_debug || prio != LOG_DEBUG) { \
|
||||
if (use_syslog || opt_log_output || prio <= opt_log_level) { \
|
||||
char tmp42[LOGBUFSIZ]; \
|
||||
snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \
|
||||
_simplelog(prio, tmp42, false); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define applogsiz(prio, _SIZ, fmt, ...) do { \
|
||||
if (opt_debug || prio != LOG_DEBUG) { \
|
||||
if (use_syslog || opt_log_output || prio <= opt_log_level) { \
|
||||
|
Loading…
x
Reference in New Issue
Block a user