console 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -7
- data/lib/console/filter.rb +2 -2
- data/lib/console/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bded8af5dd4c678a7dd209c062f622d55cac4645bb490b9e7484a7bea9a7b688
|
4
|
+
data.tar.gz: a80bdc503770d93315d3fa4341d12cfa1f27a57b8eab5296d7c67db8057a906a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2744fbc53ee930f47123d0d4b01262ef1e7518c50bf718a7f10edd1de669fac75c9104d30eb7aaf1d42fe970f2a6013315cf2ba45a352375ee851301274b955
|
7
|
+
data.tar.gz: 27a0143476c5368c276baa69b8498d26a29dd3c8cdc92d6f341255d4039d5a9bcd3b5b8c35024ef3108fb5e778d429671327d1158bc356fac72f58d70502aac1
|
data/README.md
CHANGED
@@ -91,15 +91,13 @@ end
|
|
91
91
|
Console.logger.info("My Console", MyConsole.new)
|
92
92
|
```
|
93
93
|
|
94
|
-
####
|
94
|
+
#### Failure Events
|
95
95
|
|
96
|
-
`Console::
|
96
|
+
`Console::Event::Failure` represents an exception and will log the message and backtrace recursively.
|
97
97
|
|
98
|
-
####
|
98
|
+
#### Spawn Events
|
99
99
|
|
100
|
-
`Console::
|
101
|
-
|
102
|
-
### Multiple Loggers
|
100
|
+
`Console::Event::Spawn` represents the execution of a command, and will log the environment, arguments and options used to execute it.
|
103
101
|
|
104
102
|
### Custom Log Levels
|
105
103
|
|
@@ -118,6 +116,8 @@ logger.broken("It's so janky.")
|
|
118
116
|
|
119
117
|
### Multiple Outputs
|
120
118
|
|
119
|
+
Use `Console::Split` to log to multiple destinations.
|
120
|
+
|
121
121
|
```ruby
|
122
122
|
require 'console/terminal'
|
123
123
|
require 'console/serialized/logger'
|
@@ -125,13 +125,30 @@ require 'console/logger'
|
|
125
125
|
require 'console/split'
|
126
126
|
|
127
127
|
terminal = Console::Terminal::Logger.new
|
128
|
-
file = Console::Serialized::Logger.new(File.open("
|
128
|
+
file = Console::Serialized::Logger.new(File.open("log.json", "a"))
|
129
129
|
|
130
130
|
logger = Console::Logger.new(Console::Split[terminal, file])
|
131
131
|
|
132
132
|
logger.info "I can go everywhere!"
|
133
133
|
```
|
134
134
|
|
135
|
+
### Custom Logger Output
|
136
|
+
|
137
|
+
`Console::Logger` provides a default interface which is a drop in replacemnet for `Logger` and other similar implementations. The only method required for output is `#call(*arguments, **options, &block)`.
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
require 'console/logger'
|
141
|
+
|
142
|
+
output = proc do |*arguments, **options, &block|
|
143
|
+
puts "arguments: #{arguments.inspect} options: #{options.inspect} block: #{block.call}"
|
144
|
+
end
|
145
|
+
|
146
|
+
logger = Console::Logger.new(output)
|
147
|
+
|
148
|
+
logger.info("Hello World!", meta: "data") {"block"}
|
149
|
+
# => arguments: ["Hello World!"] options: {:severity=>:info, :meta=>"data"} block: block
|
150
|
+
```
|
151
|
+
|
135
152
|
## Contributing
|
136
153
|
|
137
154
|
1. Fork it
|
data/lib/console/filter.rb
CHANGED
@@ -34,11 +34,11 @@ module Console
|
|
34
34
|
levels.each do |name, level|
|
35
35
|
const_set(name.to_s.upcase, level)
|
36
36
|
|
37
|
-
define_method(name) do |subject = nil, *arguments, &block|
|
37
|
+
define_method(name) do |subject = nil, *arguments, **options, &block|
|
38
38
|
enabled = @subjects[subject.class]
|
39
39
|
|
40
40
|
if enabled == true or (enabled != false and level >= @level)
|
41
|
-
self.call(subject, *arguments, severity: name, **@options, &block)
|
41
|
+
self.call(subject, *arguments, severity: name, **options, **@options, &block)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
data/lib/console/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: covered
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.0.
|
118
|
+
rubygems_version: 3.0.3
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Beautiful logging for Ruby.
|