Skip to content
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

feat(logger): optional subcontext #1046

Merged
merged 1 commit into from
Jun 24, 2019
Merged

feat(logger): optional subcontext #1046

merged 1 commit into from
Jun 24, 2019

Conversation

sangaman
Copy link
Collaborator

This adds an optional subcontext for loggers to print on every log statement. This is used in place of wrapping the log methods for the lnd loggers to display currency, but can also be reused in a generic fashion going forward.

Before:

19/06/2019 15:44:43.634 [LND] info: BTC: trying to verify connection...

After:

19/06/2019 15:44:43.634 [LND-BTC] info: trying to verify connection...

This is an offshoot of #1039.

@sangaman sangaman added the logging Log messages and output label Jun 19, 2019
@sangaman sangaman requested review from a user and kilrau June 19, 2019 20:28
@sangaman sangaman self-assigned this Jun 19, 2019
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Minor style nit.

lib/Logger.ts Outdated Show resolved Hide resolved
@@ -41,21 +41,6 @@ class SwapClientManager extends EventEmitter {
this.raidenClient = new RaidenClient(config.raiden, loggers.raiden);
}

/**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! Loving that we get to delete this code.

This adds an optional subcontext for loggers to print on every log
statement. This is used in place of wrapping the log methods for the lnd
loggers to display currency, but can also be reused in a generic fashion
going forward.

Before:

```
19/06/2019 15:44:43.634 [LND] info: BTC: trying to verify connection...
```

After:

```
19/06/2019 15:44:43.634 [LND-BTC] info: trying to verify connection...
```
@sangaman sangaman merged commit 926610f into master Jun 24, 2019
@sangaman sangaman deleted the lnd-logger branch June 24, 2019 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging Log messages and output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants