tty-logger 0.1.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +62 -0
- data/README.md +300 -48
- data/lib/tty/logger.rb +187 -51
- data/lib/tty/logger/config.rb +63 -5
- data/lib/tty/logger/data_filter.rb +118 -0
- data/lib/tty/logger/event.rb +2 -2
- data/lib/tty/logger/formatters/json.rb +3 -4
- data/lib/tty/logger/formatters/text.rb +7 -6
- data/lib/tty/logger/handlers/base.rb +13 -0
- data/lib/tty/logger/handlers/console.rb +37 -14
- data/lib/tty/logger/levels.rb +34 -18
- data/lib/tty/logger/version.rb +3 -3
- metadata +15 -52
- data/Rakefile +0 -8
- data/examples/console.rb +0 -22
- data/examples/error.rb +0 -11
- data/examples/handler.rb +0 -19
- data/examples/output.rb +0 -15
- data/examples/override.rb +0 -29
- data/examples/stream.rb +0 -22
- data/spec/spec_helper.rb +0 -31
- data/spec/unit/add_handler_spec.rb +0 -25
- data/spec/unit/config_spec.rb +0 -107
- data/spec/unit/event_spec.rb +0 -22
- data/spec/unit/exception_spec.rb +0 -45
- data/spec/unit/formatter_spec.rb +0 -70
- data/spec/unit/formatters/json_spec.rb +0 -41
- data/spec/unit/formatters/text_spec.rb +0 -82
- data/spec/unit/handler_spec.rb +0 -83
- data/spec/unit/handlers/custom_spec.rb +0 -26
- data/spec/unit/handlers/null_spec.rb +0 -15
- data/spec/unit/handlers/stream_spec.rb +0 -72
- data/spec/unit/levels_spec.rb +0 -40
- data/spec/unit/log_metadata_spec.rb +0 -55
- data/spec/unit/log_spec.rb +0 -144
- data/spec/unit/output_spec.rb +0 -40
- data/tasks/console.rake +0 -11
- data/tasks/coverage.rake +0 -11
- data/tasks/spec.rake +0 -29
- data/tty-logger.gemspec +0 -35
data/spec/unit/output_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe TTY::Logger, "outputs" do
|
4
|
-
let(:styles) { TTY::Logger::Handlers::Console::STYLES }
|
5
|
-
|
6
|
-
it "outputs to multiple streams of the same handler" do
|
7
|
-
stream = StringIO.new
|
8
|
-
|
9
|
-
logger = TTY::Logger.new do |config|
|
10
|
-
config.handlers = [[:stream, formatter: :text]]
|
11
|
-
config.output = [stream, stream]
|
12
|
-
end
|
13
|
-
|
14
|
-
logger.info("logging")
|
15
|
-
|
16
|
-
expect(stream.string).to eq([
|
17
|
-
"level=info message=logging\n",
|
18
|
-
"level=info message=logging\n"
|
19
|
-
].join)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "outputs each handler to a different stream" do
|
23
|
-
stream = StringIO.new
|
24
|
-
|
25
|
-
logger = TTY::Logger.new do |config|
|
26
|
-
config.handlers = [
|
27
|
-
[:console, output: stream],
|
28
|
-
[:stream, output: stream]
|
29
|
-
]
|
30
|
-
end
|
31
|
-
|
32
|
-
logger.info("logging")
|
33
|
-
|
34
|
-
expect(stream.string).to eq([
|
35
|
-
"\e[32m#{styles[:info][:symbol]}\e[0m \e[32minfo\e[0m ",
|
36
|
-
"logging \n",
|
37
|
-
"level=info message=logging\n"
|
38
|
-
].join)
|
39
|
-
end
|
40
|
-
end
|
data/tasks/console.rake
DELETED
data/tasks/coverage.rake
DELETED
data/tasks/spec.rake
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
desc 'Run all specs'
|
7
|
-
RSpec::Core::RakeTask.new(:spec) do |task|
|
8
|
-
task.pattern = 'spec/{unit,integration}{,/*/**}/*_spec.rb'
|
9
|
-
end
|
10
|
-
|
11
|
-
namespace :spec do
|
12
|
-
desc 'Run unit specs'
|
13
|
-
RSpec::Core::RakeTask.new(:unit) do |task|
|
14
|
-
task.pattern = 'spec/unit{,/*/**}/*_spec.rb'
|
15
|
-
end
|
16
|
-
|
17
|
-
desc 'Run integration specs'
|
18
|
-
RSpec::Core::RakeTask.new(:integration) do |task|
|
19
|
-
task.pattern = 'spec/integration{,/*/**}/*_spec.rb'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
rescue LoadError
|
24
|
-
%w[spec spec:unit spec:integration].each do |name|
|
25
|
-
task name do
|
26
|
-
$stderr.puts "In order to run #{name}, do `gem install rspec`"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/tty-logger.gemspec
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
lib = File.expand_path("lib", __dir__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "tty/logger/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "tty-logger"
|
7
|
-
spec.version = TTY::Logger::VERSION
|
8
|
-
spec.authors = ["Piotr Murach"]
|
9
|
-
spec.email = ["me@piotrmurach.com"]
|
10
|
-
spec.summary = %q{Readable, structured and beautiful terminal logging}
|
11
|
-
spec.description = %q{Readable, structured and beautiful terminal logging}
|
12
|
-
spec.homepage = "https://piotrmurach.github.io/tty"
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
-
spec.metadata["bug_tracker_uri"] = "https://github.com/piotrmurach/tty-logger/issues"
|
17
|
-
spec.metadata["changelog_uri"] = "https://github.com/piotrmurach/tty-logger/blob/master/CHANGELOG.md"
|
18
|
-
spec.metadata["documentation_uri"] = "https://www.rubydoc.info/gems/tty-logger"
|
19
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
-
spec.metadata["source_code_uri"] = "https://github.com/piotrmurach/tty-logger"
|
21
|
-
|
22
|
-
spec.files = Dir['{lib,spec,examples}/**/*.rb']
|
23
|
-
spec.files += Dir['tasks/*', 'tty-logger.gemspec']
|
24
|
-
spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
|
25
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
-
spec.require_paths = ["lib"]
|
27
|
-
|
28
|
-
spec.required_ruby_version = '>= 2.0.0'
|
29
|
-
|
30
|
-
spec.add_dependency "pastel", "~> 0.7.0"
|
31
|
-
|
32
|
-
spec.add_development_dependency "bundler", ">= 1.5"
|
33
|
-
spec.add_development_dependency "rake"
|
34
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
-
end
|