-
Notifications
You must be signed in to change notification settings - Fork 245
feat(log): support verbosing logging #61
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
base: master
Are you sure you want to change the base?
Conversation
|
/cc @niieani @tterranigma |
niieani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the variable name and revert the formatting of the files so it is consistent. I presume you used some auto-formatter on the file, hence it rolled together the if/thens?
Thanks.
lib/util/log.sh
Outdated
| if [[ ! -z ${__oo__loggers["$logger"]} ]] | ||
| then | ||
| ${__oo__loggers["$logger"]} "$@" | ||
| if [[ ! -z ${__oo__loggers["$logger"]} ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repository uses syntax with a new line, so I'd prefer to keep it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
lib/util/log.sh
Outdated
| for logger in "${loggers[@]}" | ||
| do | ||
| loggers=(${loggerList//;/ }) | ||
| for logger in "${loggers[@]}"; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repository uses syntax with a new line, so I'd prefer to keep it consistent.
lib/util/log.sh
Outdated
| then | ||
| if [[ -z $logged ]] || [[ ${__oo__logDisabledFilter["$scope"]} == true ]] | ||
| then | ||
| if [[ ! -z "${__oo__logScopeOutputs["$scope"]}" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repository uses syntax with a new line, so I'd prefer to keep it consistent.
lib/util/log.sh
Outdated
| declare -Ag __oo__loggers | ||
|
|
||
| # Controls verbosity of the script output and logging. | ||
| VERBOSE="${VERBOSE:-5}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use something like __oo__verbosity for the variable name, VERBOSE can conflict with a user-space variable of the same name.
Ideally, we'd set this variable with some configuration function, but I can accept this as a temporary workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the variable VERBOSE is for user to set.
Just like the example, before or after users import util/log, they can set/change the VERBOSE level by themselves to determine which log will be displayed
VERBOSE=2
Log::AddOutput test/verbose DEBUG
Log "this log will be displayed"
V=2 Log "this log will be displayed"
VERBOSE=1
V=2 Log "this log will not be displayed"
|
ping @niieani And |
Example