You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Problem
Log message can appear in output channels(such as Amazon Q Logs as
shown), IDE Debug console, or write to pre-defined log file
destinations. They come from all parts of our services and can amount to
large and lengthy chunks quickly.
We don’t have a reliable way to identify log messages from various
services and modules of our product. Some messages might have headers
while others don’t, and the existing headers are hard-coded on a message
by message basis, with no checks for consistency.
1. It’s difficult to locate and trace unidentified log messages when the
size of logs grow quickly.
2. Without regulation, the hard-coded custom headers can lead to legacy
issues down-the-road and inconsistencies within the codebase.
## Solution
1. Make message topic identifiers an input variable of the getLogger()
function.
2. Append the topic at the front of each message, for example:
`getLogger('S3').error('Something went wrong')`
Would print:
`S3: Something went wrong`
3. Define a set of topics to be used in message headers, covering all
services and modules.
## Implementation notes:
1. The `WinstonToolkitLogger` is renamed to `ToolkitLogger` to avoid
confusion, since its our own logger not winston's. The log topic feature
is added here.
2. A `baseLogger` abstract class is created to make the existing
`NullLogger`, `ConsoleLogger`, and `ToolkitLogger` cleaner and their
responsibilities more obvious and compact.
3. Currently the topics are optional, and the values are just `Test` and
`Unknown`, this will be expanded during migration of existing logger
calls.
---
<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->
License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---------
Co-authored-by: Nikolas Komonen <[email protected]>
0 commit comments