How to use debug.file_level

My goal is to cut down the amount of chatter in the logs.

I wrote this code, and put it into test_file_level.c

  LOG (LL_VERBOSE_DEBUG, ("verbose_debug %d", LL_VERBOSE_DEBUG));
  LOG (LL_DEBUG, ("debug %d", LL_DEBUG));
  LOG (LL_INFO, ("info %d", LL_INFO));
  LOG (LL_WARN, ("warn %d", LL_WARN));
  LOG (LL_ERROR, ("error %d", LL_ERROR));
  LOG (LL_NONE, ("none %d", LL_NONE));

No matter if I do

mos config-set --no-reboot debug.file_level=test_file_debug=4

or

mos config-set --no-reboot debug.file_level=test_file_debug=0

I always get

[Jul 19 17:31:42.591] test_file_debug.c:13    info 2
[Jul 19 17:31:42.591] test_file_debug.c:14    warn 1
[Jul 19 17:31:42.599] test_file_debug.c:15    error 0
[Jul 19 17:31:42.599] test_file_debug.c:16    none -1

My expectation is that which levels are actually logged would be changed when I change debug.file_level.

How is debug.file_level supposed to work?

The LOG macro uses the ´debug.level´ setting.

mos --port ws://192.168.1.210/rpc config-set debug.file_level="main.c=4"
[Jul 20 10:22:13.160] main.c:39               verbose_debug 4
[Jul 20 10:22:13.162] main.c:40               debug 3
[Jul 20 10:22:13.165] main.c:41               info 2
[Jul 20 10:22:13.168] main.c:42               warn 1
[Jul 20 10:22:13.171] main.c:43               error 0
[Jul 20 10:22:13.174] main.c:44               none -1
mos --port ws://192.168.1.210/rpc config-set debug.file_level="main.c=1"
[Jul 20 10:24:35.307] main.c:42               warn 1
[Jul 20 10:24:35.310] main.c:43               error 0
[Jul 20 10:24:35.313] main.c:44               none -1

@nliviu - Oops, I overlooked that in the release notes … so it was kind of a syntax error. Sorry for misleading here …

Looks like debug.file_level can’t be changed on the fly (you need to let the device restart for changes to take effect)?

Yes, it’s read once in mgos_sys_config_init

Ok, it’s working that way for me.

Does https://mongoose-os.com/docs/mongoose-os/userguide/debug.md need updating?