Skip to content

Commit

Permalink
Merge 1355bd0 into bcac1b5
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanp committed Oct 14, 2019
2 parents bcac1b5 + 1355bd0 commit 2f1edf5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/console/filter.rb
Expand Up @@ -100,11 +100,11 @@ def verbose!(value = true)
end

def off!
@level = -1
@level = self.class::MAXIMUM_LEVEL + 1
end

def all!
@level = self.class::MAXIMUM_LEVEL
@level = -1
end

# You can enable and disable logging for classes. This function checks if logging for a given subject is enabled.
Expand Down
26 changes: 26 additions & 0 deletions spec/console/logger_spec.rb
Expand Up @@ -92,4 +92,30 @@
subject.debug(object, message)
end
end

describe "#off!" do
before do
subject.off!
end

described_class::LEVELS.each do |name, level|
it "doesn't log #{name} messages" do
expect(output).to_not receive(:call)
subject.send(name, message)
end
end
end

describe "#all!" do
before do
subject.all!
end

described_class::LEVELS.each do |name, level|
it "can log #{name} messages" do
expect(output).to receive(:call).with(message, severity: name)
subject.send(name, message)
end
end
end
end

0 comments on commit 2f1edf5

Please sign in to comment.