Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Helper utility for better logging
Overview
This utility introduces following features:
Usage
Initializing logger instance
Basic logging - behavior is equivalent to
core
moduleGrouping (collapsable groups supported by github actions)
Just like in core module collapsable groups can be used by invoking methods
startGroup
andendGroup
, everything in-between will be placed in collapsable group. Behavior is also the same as in core module: declaring new group without explicitly closing first one will close previous group implicitly and start a new one, invokingendGroup
when no group is active will result in no effect.Additional features for better readability in environments where collapsable groups are not supported.
Core addapter accepts one parameter which indicates whether groups are supported.
If not, instead of outputting commands, messages will be displayed with title of a group in parentheses:
Contexts
Contexts allow to write additional information in [parenthesis] before main logging message to help navigating through logs. Contexts are used much the same as groups:
Contexts are heirarchically lower the groups. Therefore, if one or more contexts are defined within the group, they will stop being active as soon as group is closed:
If context was declared outside of a group, the group title will inherit prefixes and all messages within group will appear without context as they now all would be under the same title:
Wrapper functions for contexts and groups
withGroup
withGroupSync
withContext
withContextSync
Are serving the purpose of automating invocation of closing function. sync and async versions have the same semantics and api and serve for wrapping synchronous and asynchronous code respectively.
They also do not allow to go lower than context or group defined by them in order to keep behavior consistent and avoid unnecessary debugging
Therefore, contexts defined by wrapper-functions would not allow to remove that particular context within the same function and groups defined by wrapper-functions would not allow to end group defined within that same function as well as switching to a different group.