log/scripts: introduce proper log level fallback and env getter function#2506
log/scripts: introduce proper log level fallback and env getter function#2506georglauterbach merged 9 commits intomasterfrom
Conversation
This PR does two small things: 1. The log level, in case it is unset, will now be "calculated" from `/etc/dms-settings` and not always default to `info`. This way, we can ensure that more often than not, the log level the user chose when starting DMS is used everywhere. 2. I noticed that the way I obtained the log level could be used to obtain any env variable's log level. I therefore added a function to `utils.sh` in case we use it in the future.
|
Not sure whether there actually is a use case for the new function in
Does this even happen? |
In That might be a better way to safe-guard against maintenance changes shuffling/splitting stuff around across files or importing specific helpers (although some of these may also depend on methods from other helpers... they were all originally introduced as importing |
Yes, we need to take care what to import and where to import. We will need to prevent a "sourcing hell" where we're not sure what is already sourced and what is not. I think I have a solution. I will provide this solution and the appropriate adjustments in a separate PR. EDIT: Actually, we're quite fine as of now when it comes to importing helpers. We're only sourcing |
I was worried in case |
Co-authored-by: Casper <[email protected]>
casperklein
left a comment
There was a problem hiding this comment.
One last minor thing I noticed. Otherwise LGTM.
Description
This PR does two small things:
/etc/dms-settingsand not always default toinfo. This way, wecan ensure that more often than not, the log level the user chose
when starting DMS is used everywhere.
obtain any env variable's value. I therefore added a function to
utils.shin case we use it in the future.The reason for not using the new function from
utils.shinlog.shis that I would like to preservelog.sh's property of not being dependent on other helper scripts.(There is a typo in the commit message:
obtain any env variable's log level->obtain any env variable's value- don't get confused 😉)Type of change
Checklist:
docs/)