From cd8a20d7ff0af28912dfa3e412a63670481b3324 Mon Sep 17 00:00:00 2001 From: Brian Durand Date: Wed, 26 Aug 2020 23:00:35 -0700 Subject: [PATCH 1/2] fix readme --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index b12c067..ae6c9fd 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,8 @@ [![Maintainability](https://api.codeclimate.com/v1/badges/a0abc03721fff9b0cde1/maintainability)](https://codeclimate.com/github/bdurand/lumberjack/maintainability) [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard) -# Is It Broken? # Lumberjack -[![Build Status](https://travis-ci.org/bdurand/lumberjack.svg?branch=master)](https://travis-ci.org/bdurand/lumberjack) -[![Maintainability](https://api.codeclimate.com/v1/badges/a0abc03721fff9b0cde1/maintainability)](https://codeclimate.com/github/bdurand/lumberjack/maintainability) - Lumberjack is a simple, powerful, and fast logging implementation in Ruby. It uses nearly the same API as the Logger class in the Ruby standard library and as ActiveSupport::BufferedLogger in Rails. ## Usage From 1f8f4591bbdc58f79f32d601cdb60fa63346c258 Mon Sep 17 00:00:00 2001 From: Brian Durand Date: Thu, 27 Aug 2020 07:41:06 -0700 Subject: [PATCH 2/2] change method name to untagged --- CHANGELOG.md | 24 ++++++++++++------------ lib/lumberjack/logger.rb | 8 ++++---- spec/logger_spec.rb | 12 ++++++------ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1fc68..7c7650d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,14 @@ ## 1.2.8 -* Add `Logger#untag` to remove previously set logging tags from a block. +* Add `Logger#untagged` to remove previously set logging tags from a block. ## 1.2.7 -* Allow passing frozen hashes to `Logger.tag`. Tags passed to this method are now duplicated so the logger maintains it's own copy of the hash. +* Allow passing frozen hashes to `Logger#tag`. Tags passed to this method are now duplicated so the logger maintains it's own copy of the hash. ## 1.2.6 -* Fix Logger#tag so it only ads to the current block's logger tags instead of the global tags if called inside a `Logger#tag` block. +* Fix `Logger#tag` so it only ads to the current block's logger tags instead of the global tags if called inside a `Logger#tag` block. * Add Logger#remove_tag ## 1.2.5 @@ -18,7 +18,7 @@ ## 1.2.4 -* Enhance ActiveSupport::TaggedLogging support so code that Lumberjack loggers can be wrapped with a tagged logger. +* Enhance `ActiveSupport::TaggedLogging` support so code that Lumberjack loggers can be wrapped with a tagged logger. ## 1.2.3 @@ -34,7 +34,7 @@ ## 1.2.0 -* Enable compatibility with ActiveSupport::TaggedLogger by calling `tagged_logger!` on a logger. +* Enable compatibility with `ActiveSupport::TaggedLogger` by calling `tagged_logger!` on a logger. * Add `tag_formatter` to logger to specify formatting of tags for output. * Allow adding and removing classes by name to formatters. * Allow adding and removing multiple classes in a single call to a formatter. @@ -53,7 +53,7 @@ ## 1.1.0 -* Change Lumberjack::Logger to inherit from ::Logger +* Change `Lumberjack::Logger` to inherit from ::Logger * Add support for tags on log messages * Add global tag context for all loggers * Add per logger tags and tag contexts @@ -61,8 +61,8 @@ * Add support for setting datetime format on log devices * Performance optimizations * Add Multi device to output to multiple devices -* Add DateTimeFormatter, IdFormatter, ObjectFormatter, and StructuredFormatter -* Add rack Context middleware for setting thread global context +* Add `DateTimeFormatter`, `IdFormatter`, `ObjectFormatter`, and `StructuredFormatter` +* Add rack `Context` middleware for setting thread global context * End support for ruby versions < 2.3 * Add support for modules in formatters @@ -74,7 +74,7 @@ ## 1.0.12 -* Add support for ActionDispatch request id for better Rails compatibility. +* Add support for `ActionDispatch` request id for better Rails compatibility. ## 1.0.11 @@ -88,11 +88,11 @@ ## 1.0.9 -* Add method so Formatter is compatible with ActiveSupport logging extensions. +* Add method so Formatter is compatible with `ActiveSupport` logging extensions. ## 1.0.8 -* Fix another internal variable name conflict with ActiveSupport logging extensions. +* Fix another internal variable name conflict with `ActiveSupport` logging extensions. ## 1.0.7 @@ -100,7 +100,7 @@ ## 1.0.6 -* Fix internal variable name conflict with ActiveSupport logging extensions. +* Fix internal variable name conflict with `ActiveSupport` logging extensions. ## 1.0.5 diff --git a/lib/lumberjack/logger.rb b/lib/lumberjack/logger.rb index ab1345a..ac4b654 100644 --- a/lib/lumberjack/logger.rb +++ b/lib/lumberjack/logger.rb @@ -392,18 +392,18 @@ def tags end # Remove all tags on the current logger and logging context within a block. - # You can still set new block scoped tags within the untagged block and provide + # You can still set new block scoped tags within theuntagged block and provide # tags on individual log methods. - def untag(&block) + def untagged(&block) Lumberjack.use_context(nil) do scope_tags = thread_local_value(:lumberjack_logger_tags) - untagged = thread_local_value(:lumberjack_logger_untagged) + untagged = thread_local_value(:lumberjack_logger_untagged) begin set_thread_local_value(:lumberjack_logger_untagged, true) set_thread_local_value(:lumberjack_logger_tags, nil) tag({}, &block) ensure - set_thread_local_value(:lumberjack_logger_untagged, untagged) + set_thread_local_value(:lumberjack_logger_untagged,untagged) set_thread_local_value(:lumberjack_logger_tags, scope_tags) end end diff --git a/spec/logger_spec.rb b/spec/logger_spec.rb index 1c235d3..f50260f 100644 --- a/spec/logger_spec.rb +++ b/spec/logger_spec.rb @@ -546,12 +546,12 @@ end end - describe "untag" do + describe "untagged" do it "should remove tags from the Lumberjack::Context" do Lumberjack.context do Lumberjack.tag(foo: "bar") expect(logger.tags).to eq({"foo" => "bar"}) - logger.untag do + logger.untagged do expect(logger.tags).to eq({}) end expect(logger.tags).to eq({"foo" => "bar"}) @@ -562,7 +562,7 @@ logger.tag(foo: "bar") begin expect(logger.tags).to eq({"foo" => "bar"}) - logger.untag do + logger.untagged do expect(logger.tags).to eq({}) end expect(logger.tags).to eq({"foo" => "bar"}) @@ -574,7 +574,7 @@ it "should remove scoped tags from teh logger" do logger.tag(foo: "bar") do expect(logger.tags).to eq({"foo" => "bar"}) - logger.untag do + logger.untagged do expect(logger.tags).to eq({}) end expect(logger.tags).to eq({"foo" => "bar"}) @@ -584,10 +584,10 @@ it "should allow adding tags inside the block" do logger.tag(foo: "bar") do expect(logger.tags).to eq({"foo" => "bar"}) - logger.untag do + logger.untagged do logger.tag(stuff: "other") do expect(logger.tags).to eq({"stuff" => "other"}) - logger.untag do + logger.untagged do expect(logger.tags).to eq({}) logger.tag(thing: 1) expect(logger.tags).to eq({"thing" => 1})