log: sane version of systemd-journal loglevels
I dropped support of partial lines when logging but log macro now looks way mor nicier. Signed-off-by: Andrej Manduch <amanduch@gmail.com> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
parent
03701f91bc
commit
032b8c814f
|
@ -294,10 +294,13 @@ static void dump_irq(struct irq_info *info, void *data)
|
||||||
{
|
{
|
||||||
int spaces = (long int)data;
|
int spaces = (long int)data;
|
||||||
int i;
|
int i;
|
||||||
char indent_char[2] = {log_indent[0], '\0'};
|
char * indent = malloc (sizeof(char) * (spaces + 1));
|
||||||
|
|
||||||
for (i=0; i<spaces; i++) log(TO_CONSOLE, LOG_INFO, indent_char);
|
for ( i = 0; i < spaces; i++ )
|
||||||
log(TO_CONSOLE, LOG_INFO, "Interrupt %i node_num is %d (%s/%u) \n",
|
indent[i] = log_indent[0];
|
||||||
|
|
||||||
|
indent[i] = '\0';
|
||||||
|
log(TO_CONSOLE, LOG_INFO, "%sInterrupt %i node_num is %d (%s/%u) \n", indent,
|
||||||
info->irq, irq_numa_node(info)->number, classes[info->class], (unsigned int)info->load);
|
info->irq, irq_numa_node(info)->number, classes[info->class], (unsigned int)info->load);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,6 @@ char *banscript = NULL;
|
||||||
char *polscript = NULL;
|
char *polscript = NULL;
|
||||||
long HZ;
|
long HZ;
|
||||||
|
|
||||||
#ifdef HAVE_SYSTEMD
|
|
||||||
char *line_buffer_7ee22e61_f183;
|
|
||||||
char *log_buffer_4c93_8665;
|
|
||||||
#endif /* HAVE_SYSTEMD */
|
|
||||||
|
|
||||||
static void sleep_approx(int seconds)
|
static void sleep_approx(int seconds)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
@ -264,10 +259,6 @@ int main(int argc, char** argv)
|
||||||
sigaddset(&sigset,SIGUSR1);
|
sigaddset(&sigset,SIGUSR1);
|
||||||
sigaddset(&sigset,SIGUSR2);
|
sigaddset(&sigset,SIGUSR2);
|
||||||
sigprocmask(SIG_BLOCK, &sigset, &old_sigset);
|
sigprocmask(SIG_BLOCK, &sigset, &old_sigset);
|
||||||
#ifdef HAVE_SYSTEMD
|
|
||||||
line_buffer_7ee22e61_f183 = malloc(sizeof(char) * 2048);
|
|
||||||
log_buffer_4c93_8665 = malloc(sizeof(char) * 2048);
|
|
||||||
#endif /* HAVE_SYSTEMD */
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
parse_command_line(argc, argv);
|
parse_command_line(argc, argv);
|
||||||
#else /* ! HAVE_GETOPT_LONG */
|
#else /* ! HAVE_GETOPT_LONG */
|
||||||
|
|
12
irqbalance.h
12
irqbalance.h
|
@ -138,18 +138,10 @@ static inline void for_each_object(GList *list, void (*cb)(struct topo_obj *obj,
|
||||||
extern char * log_indent;
|
extern char * log_indent;
|
||||||
extern unsigned int log_mask;
|
extern unsigned int log_mask;
|
||||||
#ifdef HAVE_SYSTEMD
|
#ifdef HAVE_SYSTEMD
|
||||||
extern char *line_buffer_7ee22e61_f183;
|
|
||||||
extern char *log_buffer_4c93_8665;
|
|
||||||
#define log(mask, lvl, fmt, args...) do { \
|
#define log(mask, lvl, fmt, args...) do { \
|
||||||
if (journal_logging) { \
|
if (journal_logging) { \
|
||||||
sprintf(log_buffer_4c93_8665,fmt, ##args); \
|
printf("<%d>", lvl); \
|
||||||
strcat(line_buffer_7ee22e61_f183, log_buffer_4c93_8665); \
|
printf(fmt, ##args); \
|
||||||
if (line_buffer_7ee22e61_f183[strlen(line_buffer_7ee22e61_f183)-1]\
|
|
||||||
== '\n' || strlen(line_buffer_7ee22e61_f183) > 256 ) { \
|
|
||||||
printf("<%d>%s", lvl, line_buffer_7ee22e61_f183); \
|
|
||||||
line_buffer_7ee22e61_f183[0] = '\0'; \
|
|
||||||
line_buffer_7ee22e61_f183[0] = '\0'; \
|
|
||||||
} \
|
|
||||||
} else { \
|
} else { \
|
||||||
if (log_mask & mask & TO_SYSLOG) \
|
if (log_mask & mask & TO_SYSLOG) \
|
||||||
syslog(lvl, fmt, ##args); \
|
syslog(lvl, fmt, ##args); \
|
||||||
|
|
Loading…
Reference in a new issue