Skip to content

Commit

Permalink
vivectl: make the default log level INFO.
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Gil Peyrot committed Oct 17, 2016
1 parent fb6429b commit 6f9e8bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/vl_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "vl_log.h"

static Level log_level = Level::Debug;
static Level log_level = Level::DEBUG;

void vl_set_log_level(Level level) {
log_level = level;
Expand Down
16 changes: 8 additions & 8 deletions src/vl_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#pragma once

enum class Level : int {
Debug,
Info,
Warning,
Error
DEBUG,
INFO,
WARNING,
ERROR,
};

void vl_set_log_level(Level level);
Expand All @@ -35,7 +35,7 @@ __attribute__((format(printf, 2, 3)))
#endif
void vl_log(Level level, const char* format, ...);

#define vl_debug(...) vl_log(Level::Debug, __VA_ARGS__)
#define vl_info(...) vl_log(Level::Info, __VA_ARGS__)
#define vl_warn(...) vl_log(Level::Warning, __VA_ARGS__)
#define vl_error(...) vl_log(Level::Error, __VA_ARGS__)
#define vl_debug(...) vl_log(Level::DEBUG, __VA_ARGS__)
#define vl_info(...) vl_log(Level::INFO, __VA_ARGS__)
#define vl_warn(...) vl_log(Level::WARNING, __VA_ARGS__)
#define vl_error(...) vl_log(Level::ERROR, __VA_ARGS__)
5 changes: 4 additions & 1 deletion tools/vivectl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ static void read_hmd_light(uint8_t* buffer, int size, vl_driver* driver) {
vl_report_id report_id = static_cast<vl_report_id>(buffer[0]);

if (report_id != vl_report_id::HMD_LIGHTHOUSE_PULSE2) {
vl_error("Wrong light message type, expected %d got %d.", vl_report_id::HMD_LIGHTHOUSE_PULSE2, buffer[0]);
vl_error("Wrong light message type, expected %d got %d.",
static_cast<uint8_t>(vl_report_id::HMD_LIGHTHOUSE_PULSE2),
buffer[0]);
return;
}

Expand Down Expand Up @@ -258,6 +260,7 @@ typedef std::function<void(void)> taskfun;
void run(taskfun task) {
if (!task)
return;
vl_set_log_level(Level::INFO);
driver = new vl_driver();
if (!driver->init_devices(0))
return;
Expand Down

0 comments on commit 6f9e8bd

Please sign in to comment.