box: straighten log configuration code
See [1] for some details on why the code for log configuration needs some care. In short log config validity checks are spread thru many places, on some code paths we use one checks and on other code paths other checks. And we make repetitive validity checks many times in runtime on single configure call. We can also reuse code for setting default values, checking options type and resetting values to default. - As a side effect of refactoring one can now reset values to default thru `log.cfg()` so now `log.cfg()` is on par with `box.cfg` in this respect. - This patch also drops conversion `log_level` from string to number. Before (shorten): tarantool> box.cfg{log_level='warn'} tarantool> box.cfg.log_level - info tarantool> log.cfg.level - 5 Also: tarantool> log.cfg{level='info'} tarantool> log.cfg.level - 5 tarantool> box.cfg{} tarantool> box.cfg.log_level - 5 After patch if `log_level`/`level` is given as string than it is saved and returned as string too. I guess it should not affect users but looks more handy. - Also fixed issue with inconsistent setting `log_nonblock` thru `box.cfg()` and `log.cfg()`. In former case `nil` means setting default depending on logger type. In the latter case `nil` meant setting `nonblock` to `false`. - Also patch fixes #7447. Closes #7447. [1] PR for this refactoring https://github.com/tarantool/tarantool/pull/7454 NO_DOC=refactoring/tiny API improvemnent
Showing
- changelogs/unreleased/gh-7447-fix-panic-on-invalid-log.md 3 additions, 0 deletionschangelogs/unreleased/gh-7447-fix-panic-on-invalid-log.md
- extra/exports 1 addition, 2 deletionsextra/exports
- src/box/box.cc 51 additions, 21 deletionssrc/box/box.cc
- src/box/box.h 6 additions, 0 deletionssrc/box/box.h
- src/box/lua/load_cfg.lua 69 additions, 104 deletionssrc/box/lua/load_cfg.lua
- src/lib/core/say.c 40 additions, 21 deletionssrc/lib/core/say.c
- src/lib/core/say.h 13 additions, 2 deletionssrc/lib/core/say.h
- src/lua/log.lua 111 additions, 364 deletionssrc/lua/log.lua
- src/main.cc 5 additions, 6 deletionssrc/main.cc
- static-build/test/static-build/exports.test.lua 0 additions, 1 deletionstatic-build/test/static-build/exports.test.lua
- test/app-tap/gh-5130-panic-on-invalid-log.test.lua 1 addition, 1 deletiontest/app-tap/gh-5130-panic-on-invalid-log.test.lua
- test/app-tap/logger.test.lua 150 additions, 26 deletionstest/app-tap/logger.test.lua
- test/app-tap/logmod.test.lua 8 additions, 8 deletionstest/app-tap/logmod.test.lua
- test/unit/memtx_allocator.cc 1 addition, 2 deletionstest/unit/memtx_allocator.cc
- test/unit/popen.c 1 addition, 1 deletiontest/unit/popen.c
- test/unit/raft_test_utils.c 1 addition, 1 deletiontest/unit/raft_test_utils.c
- test/unit/say.c 1 addition, 1 deletiontest/unit/say.c
- test/unit/swim_proto.c 1 addition, 1 deletiontest/unit/swim_proto.c
- test/unit/swim_test_utils.c 1 addition, 1 deletiontest/unit/swim_test_utils.c
Loading
Please register or sign in to comment