bcoin-org / bcoin-org/blgr

Add an option to nest context name instead of replace in log

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3
Forks
8
PR merge metrics
No merged PRs in 30d

Description

When passing loggers to other objects, it's sometimes useful to preserve the parent context name. For example, when running multiple nodes:

Currently:
![image](https://user-images.githubusercontent.com/5113343/217870444-9abf280d-25ae-430a-94aa-d8d4d4356e33.png)

With patch:
![image](https://user-images.githubusercontent.com/5113343/217870176-a4529f93-5525-4672-be6f-cfeae789f18a.png)

Patch used above (this is just an example, it can be made optional and custom separators, etc.):
```diff
diff --git a/old.js b/new.js
index 3d37a4c..bcbdc15 100644
--- a/old.js
+++ b/new.js
@@ -814,7 +814,7 @@ class LoggerContext {
*/

context(module) {
- return new LoggerContext(this.logger, module);
+ return new LoggerContext(this.logger, this.module + ':' + module);
}

/**
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names the LoggerContext.context(module) entry point but no source file or test. Start by locating that method and tracing how context names are replaced when loggers are passed to other objects; review existing API usage before settling option and separator behavior. Done means nested names are optionally preserved while current replacement behavior remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.