CC-1181: Add secondary prefix to logger #35
Merged
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.
This pull request primarily focuses on enhancing the logging functionality in the
logger/logger.go
file. The key changes include the addition of two new fields in theLogger
struct, namelyprefix
andsecondaryPrefix
. These new fields allow for more dynamic log prefixing. Additionally, two new methods have been introduced,UpdateSecondaryPrefix
andResetSecondaryPrefix
, to manage the secondary prefix.Here are the key changes:
logger/logger.go
: Added two new fields,prefix
andsecondaryPrefix
, to theLogger
struct. These fields are used to manage the prefixes for the logs.logger/logger.go
: Modified theGetLogger
andGetQuietLogger
functions to initialize the newprefix
field.logger/logger.go
: Introduced a new methodUpdateSecondaryPrefix
that allows updating the secondary prefix and appending it to the primary prefix. If an empty string is passed, it resets the prefix to the original one.logger/logger.go
: Added a new methodResetSecondaryPrefix
that resets the secondary prefix to an empty string.This pull request adds a new method,GetLoggerWithAppendedPrefix
, which allows appending a secondary prefix to the existing logger prefix. Additionally, the existingUpdateSecondaryPrefix
method has been refactored to dynamically update the secondary prefix, and a newResetSecondaryPrefix
method has been added to reset the secondary prefix to its original value. These changes enhance the flexibility and functionality of the logger.