Skip to content

Commit

Permalink
SQUASHME: move log level to log() call
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Mar 4, 2015
1 parent d8a7588 commit 4e24aa7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
10 changes: 1 addition & 9 deletions core/include/log.h
Expand Up @@ -44,23 +44,15 @@ enum {
* @{
*/

#define LOG(level, ...) if (level <= LOG_LEVEL) _log(level, __VA_ARGS__)
#define log(level, ...) if (level <= LOG_LEVEL) _log(level, __VA_ARGS__)

/** @} */

#ifdef HAVE_LOG_MODULE
#include "log_module.h"
#else

#include <stdio.h>

#define _log(level, ...) printf(__VA_ARGS__)

#define log_error(...) LOG(LOG_ERROR, __VA_ARGS__)
#define log_warning(...) LOG(LOG_WARNING, __VA_ARGS__)
#define log_info(...) LOG(LOG_INFO, __VA_ARGS__)
#define log_debug(...) LOG(LOG_DEBUG, __VA_ARGS__)

#endif

#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions core/kernel_init.c
Expand Up @@ -82,19 +82,19 @@ static char idle_stack[KERNEL_CONF_STACKSIZE_IDLE];
void kernel_init(void)
{
(void) disableIRQ();
log_info("kernel_init(): This is RIOT! (Version: %s)\n", RIOT_VERSION);
log(LOG_INFO, "kernel_init(): This is RIOT! (Version: %s)\n", RIOT_VERSION);

hwtimer_init();

if (thread_create(idle_stack, sizeof(idle_stack), PRIORITY_IDLE, CREATE_WOUT_YIELD | CREATE_STACKTEST, idle_thread, NULL, idle_name) < 0) {
log_error("kernel_init(): error creating idle task.\n");
log(LOG_ERROR, "kernel_init(): error creating idle task.\n");
}

if (thread_create(main_stack, sizeof(main_stack), PRIORITY_MAIN, CREATE_WOUT_YIELD | CREATE_STACKTEST, main_trampoline, NULL, main_name) < 0) {
log_error("kernel_init(): error creating main task.\n");
log(LOG_ERROR, "kernel_init(): error creating main task.\n");
}

log_info("kernel_init(): jumping into first task...\n");
log(LOG_INFO, "kernel_init(): jumping into first task...\n");

cpu_switch_context_exit();
}
5 changes: 0 additions & 5 deletions sys/log/log_printfnoformat/log_module.h
Expand Up @@ -8,9 +8,4 @@ static void _log(unsigned level, const char *format, ...) {
puts(format);
}

#define log_error(...) LOG(LOG_ERROR, "E: " __VA_ARGS__)
#define log_warning(...) LOG(LOG_WARNING, "W: " __VA_ARGS__)
#define log_info(...) LOG(LOG_INFO, "I: " __VA_ARGS__)
#define log_debug(...) LOG(LOG_DEBUG, "D: " __VA_ARGS__)

#endif /* __LOG_FORMAT_H */

0 comments on commit 4e24aa7

Please sign in to comment.