tidy_logger 1.0.0 → 1.0.1
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 +54 -14
- data/tidy_logger.gemspec +3 -6
- metadata +3 -4
- data/lib/tidy_logger/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 399ecb4e4d159ae849ab5611ef91e746b85c83c0
|
4
|
+
data.tar.gz: 14e72421915437b24f4da99f3a849a53dcff6ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e59419c2d465714f6bc773c483033caec66f26918b94633aedf65226e2355008961748af8ef18916d3c6c0abfb4cdfdd062f4398e50613ecb71bcac9ea8010c3
|
7
|
+
data.tar.gz: 9f617a380f676eba25c979690e5440d900b4b279ef92b739e6943f6a6e8143dff5a7c943312e7886b1efa18362a126124986e50650377d9e289875b789f065fe
|
data/README.md
CHANGED
@@ -1,29 +1,69 @@
|
|
1
1
|
# TidyLogger
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/kenn/tidy_logger)
|
4
|
+
|
5
|
+
Better API for Ruby’s stdlib Logger
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
8
10
|
|
9
|
-
|
11
|
+
```ruby
|
12
|
+
gem 'tidy_logger'
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
10
16
|
|
11
|
-
|
17
|
+
Ruby's stdlib `Logger` is great. It gives you so many features that you don't want to reinvent.
|
12
18
|
|
13
|
-
|
19
|
+
```ruby
|
20
|
+
require 'logger'
|
14
21
|
|
15
|
-
|
22
|
+
logger = Logger.new(STDOUT)
|
23
|
+
logger.info 'hello world!' # => "I, [2013-03-21T19:46:31.703381 #27585] INFO -- : hello world!\n"
|
24
|
+
```
|
16
25
|
|
17
|
-
|
26
|
+
But, don't you think the default format is ugly? I do!
|
18
27
|
|
19
|
-
|
28
|
+
Here comes TidyLogger. It is a subclass of and 100% compatible with the stdlib Logger. You can use it and Logger interchangeably.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require 'tidy_logger'
|
32
|
+
|
33
|
+
logger = TidyLogger.new(STDOUT)
|
34
|
+
logger.info 'hello world!' # => "I, [2013-03-21T19:46:31.703381 #27585] INFO -- : hello world!\n"
|
35
|
+
```
|
36
|
+
|
37
|
+
The only method that's added to Logger is `config` - when you call it, all the shapeshifting happens.
|
38
|
+
|
39
|
+
Supported options are `plain`, `time`, `title`, `time_and_level` (chosen when no argument is given), `ltsv` ([Labeled Tab-Separated Values](http://ltsv.org)) and lambdas.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
logger = TidyLogger.new(STDOUT)
|
43
|
+
|
44
|
+
logger.config
|
45
|
+
logger.info 'hello' # => "[2013-03-21T21:19:54] INFO : hello"
|
46
|
+
|
47
|
+
logger.config(:plain)
|
48
|
+
logger.info 'hello' # => "hello"
|
49
|
+
|
50
|
+
logger.config(:time)
|
51
|
+
logger.info 'hello' # => "[2013-03-21T21:19:10] hello"
|
52
|
+
|
53
|
+
logger.config(title: 'note')
|
54
|
+
logger.info 'hello' # => "[note] hello"
|
55
|
+
|
56
|
+
logger.config(:ltsv)
|
57
|
+
logger.info fizz: 1, buzz: 2 # => "fizz:1\tbuzz:2"
|
58
|
+
|
59
|
+
logger.config lambda{|_,_,_,msg| "///do crazy stuff/// #{msg}\n" }
|
60
|
+
logger.info 'hello' # => "///do crazy stuff/// hello"
|
61
|
+
```
|
20
62
|
|
21
|
-
|
63
|
+
The `config` method returns self, so that you can tidy up in method chain.
|
22
64
|
|
23
|
-
|
65
|
+
```ruby
|
66
|
+
logger = TidyLogger.new(STDOUT).config(:plain)
|
24
67
|
|
25
|
-
|
26
|
-
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
68
|
+
logger.config(:plain).info 'foo'
|
69
|
+
```
|
data/tidy_logger.gemspec
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'tidy_logger/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
4
|
spec.name = 'tidy_logger'
|
8
|
-
spec.version =
|
5
|
+
spec.version = '1.0.1' # retrieve this value by: Gem.loaded_specs['redis-mutex'].version.to_s
|
9
6
|
spec.authors = ['Kenn Ejima']
|
10
7
|
spec.email = ['kenn.ejima@gmail.com']
|
11
|
-
spec.description = %q{TidyLogger:
|
12
|
-
spec.summary = %q{TidyLogger:
|
8
|
+
spec.description = %q{TidyLogger: Better API for Ruby’s stdlib Logger}
|
9
|
+
spec.summary = %q{TidyLogger: Better API for Ruby’s stdlib Logger}
|
13
10
|
spec.homepage = 'https://github.com/kenn/tidy_logger'
|
14
11
|
spec.license = 'MIT'
|
15
12
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tidy_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenn Ejima
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: 'TidyLogger:
|
41
|
+
description: 'TidyLogger: Better API for Ruby’s stdlib Logger'
|
42
42
|
email:
|
43
43
|
- kenn.ejima@gmail.com
|
44
44
|
executables: []
|
@@ -52,7 +52,6 @@ files:
|
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
54
|
- lib/tidy_logger.rb
|
55
|
-
- lib/tidy_logger/version.rb
|
56
55
|
- test/test_tidy_logger.rb
|
57
56
|
- tidy_logger.gemspec
|
58
57
|
homepage: https://github.com/kenn/tidy_logger
|
@@ -78,7 +77,7 @@ rubyforge_project:
|
|
78
77
|
rubygems_version: 2.0.3
|
79
78
|
signing_key:
|
80
79
|
specification_version: 4
|
81
|
-
summary: 'TidyLogger:
|
80
|
+
summary: 'TidyLogger: Better API for Ruby’s stdlib Logger'
|
82
81
|
test_files:
|
83
82
|
- test/test_tidy_logger.rb
|
84
83
|
has_rdoc:
|
data/lib/tidy_logger/version.rb
DELETED