Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement zephyr logger #137

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions prj.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CONFIG_SHELL=y
CONFIG_KERNEL_SHELL=y
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=3

CONFIG_HTTP=y
CONFIG_HTTP_CLIENT=y
Expand Down
6 changes: 4 additions & 2 deletions zephyr/sensor_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <zephyr.h>
#include <sensor.h>
#include <shell/shell.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(sensor_service); /* One per given log_module_name */
#pragma GCC diagnostic pop

/* local includes */
Expand Down Expand Up @@ -68,10 +70,10 @@ static int sensor_get(const struct shell *shell, size_t argc, char *argv[])
ARG_UNUSED(shell);

if(_last_err < 0) {
printk("error getting data from the sensor (%d)", _last_err);
LOG_WRN("error getting data from the sensor (%d)", _last_err);
return 0;
}
printk("%d C %d%%\n", _temp.val1, _humidity.val1);
LOG_INF("%d C %d%%\n", _temp.val1, _humidity.val1);
return 0;
}

Expand Down