-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ActiveSupport tagged logging support
Our logger did not support Rails ActiveSupport tagged logging yet. This was because our logger didn't listen to the `tagged`, `push_tags` and `pop_tags` methods. Implement these methods to have the logger that wraps our logger call these methods to set tags. The format is the same as Rails formats it: `[My tag value]` I decide not to set these as attributes, because they're only values. They have no key and the value can be anything and change frequently.
- Loading branch information
Showing
3 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
bump: patch | ||
type: add | ||
--- | ||
|
||
Support Rails/ActiveSupport tagged logging. When tags are set in apps using `Rails.logger.tagged { ... }` or with the `Rails.application.config.log_tags = [...]` config option, these tags are now included in the collected log messages. | ||
|
||
```ruby | ||
Rails.logger.tagged(["Tag 1", "Tag 2"]) { Rails.logger.info("My message") } | ||
``` | ||
|
||
Reports this log message: | ||
|
||
> [Tag 1] [Tag 2] My message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters