active_logger 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +12 -0
- data/.travis.yml +16 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +37 -1
- data/README.md +32 -6
- data/Rakefile +2 -0
- data/active_logger.gemspec +5 -3
- data/bin/console +1 -0
- data/lib/active_logger.rb +8 -1
- data/lib/active_logger/logger.rb +31 -0
- data/lib/active_logger/version.rb +1 -1
- data/log/.keep +0 -0
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a53153fa5f398f75e6a8585e5783498c10bf297c84ff9c39b16bebd6fd7f3886
|
4
|
+
data.tar.gz: 0210fc6195bb5b39a03ddb328f87bcf05ef9b8773298a2aef9ffbd3c57f5ca04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46610e887005de89191beffdd331fad4c4a3fb9df9a36d16cb2d70ef9ca0004d9767950b42ad35d3288e13b22b7ad4a274578b7664f758d909a83fafe7544403
|
7
|
+
data.tar.gz: 70daa0ec58408cab9b947b605dbc5a17ed5316db4c48cee433f5b0f6ffc09d9e36f5711f480f126040f4ab49ad8a4eadd612dede491f7cc0d546946972da2986
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2020-04-19 22:24:15 +0300 using RuboCop version 0.82.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Max: 12
|
data/.travis.yml
CHANGED
@@ -2,5 +2,20 @@
|
|
2
2
|
language: ruby
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
|
-
- 2.
|
5
|
+
- 2.3
|
6
|
+
- 2.4
|
7
|
+
- 2.5
|
8
|
+
- 2.6
|
9
|
+
- 2.7
|
10
|
+
- ruby-head
|
6
11
|
before_install: gem install bundler -v 2.1.2
|
12
|
+
install:
|
13
|
+
- bundle install --retry=3
|
14
|
+
script:
|
15
|
+
- bundle exec rubocop --parallel
|
16
|
+
- bundle exec rspec
|
17
|
+
matrix:
|
18
|
+
allow_failures:
|
19
|
+
- rvm: 2.3
|
20
|
+
- rvm: 2.4
|
21
|
+
- rvm: ruby-head
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_logger (0.0
|
4
|
+
active_logger (0.1.0)
|
5
|
+
activesupport (>= 5.0.0)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
10
|
+
activesupport (6.0.2.1)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
zeitwerk (~> 2.2)
|
16
|
+
ast (2.4.0)
|
17
|
+
concurrent-ruby (1.1.5)
|
9
18
|
diff-lcs (1.3)
|
19
|
+
i18n (1.8.2)
|
20
|
+
concurrent-ruby (~> 1.0)
|
21
|
+
jaro_winkler (1.5.4)
|
22
|
+
minitest (5.14.0)
|
23
|
+
parallel (1.19.1)
|
24
|
+
parser (2.7.1.1)
|
25
|
+
ast (~> 2.4.0)
|
26
|
+
rainbow (3.0.0)
|
10
27
|
rake (12.3.3)
|
28
|
+
rexml (3.2.4)
|
11
29
|
rspec (3.9.0)
|
12
30
|
rspec-core (~> 3.9.0)
|
13
31
|
rspec-expectations (~> 3.9.0)
|
@@ -21,6 +39,22 @@ GEM
|
|
21
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
40
|
rspec-support (~> 3.9.0)
|
23
41
|
rspec-support (3.9.2)
|
42
|
+
rubocop (0.82.0)
|
43
|
+
jaro_winkler (~> 1.5.1)
|
44
|
+
parallel (~> 1.10)
|
45
|
+
parser (>= 2.7.0.1)
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
rexml
|
48
|
+
ruby-progressbar (~> 1.7)
|
49
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
50
|
+
rubocop-rspec (1.38.1)
|
51
|
+
rubocop (>= 0.68.1)
|
52
|
+
ruby-progressbar (1.10.1)
|
53
|
+
thread_safe (0.3.6)
|
54
|
+
tzinfo (1.2.6)
|
55
|
+
thread_safe (~> 0.1)
|
56
|
+
unicode-display_width (1.7.0)
|
57
|
+
zeitwerk (2.2.2)
|
24
58
|
|
25
59
|
PLATFORMS
|
26
60
|
ruby
|
@@ -29,6 +63,8 @@ DEPENDENCIES
|
|
29
63
|
active_logger!
|
30
64
|
rake (~> 12.0)
|
31
65
|
rspec (~> 3.0)
|
66
|
+
rubocop (~> 0.81)
|
67
|
+
rubocop-rspec (~> 1.38)
|
32
68
|
|
33
69
|
BUNDLED WITH
|
34
70
|
2.1.2
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
[![Gem Version](http://img.shields.io/gem/v/active_logger.svg)](http://badge.fury.io/rb/active_logger) [![Build Status](https://travis-ci.com/jurrick/active_logger.svg?branch=master)](https://travis-ci.com/jurrick/active_logger)
|
2
2
|
|
3
|
-
|
3
|
+
# ActiveLogger
|
4
4
|
|
5
|
-
|
5
|
+
A rich logger extending the capabilities of the ActiveSupport logger
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,34 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### Basic example
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
logger = ActiveLogger.new :stdout
|
29
|
+
logger.info 'test' # => test
|
30
|
+
```
|
31
|
+
|
32
|
+
There are 3 types:
|
33
|
+
|
34
|
+
* `:stdout` : Messages will be written to STDOUT
|
35
|
+
* `:stderr` : Messages will be written to STDERR
|
36
|
+
* `:file` : Messages will be written to a file
|
37
|
+
|
38
|
+
### File example
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
logger = ActiveLogger.new :file, filename: 'log/development.log', keep: 30, size: 10
|
42
|
+
logger.info 'test'
|
43
|
+
|
44
|
+
# Alternative
|
45
|
+
logger = ActiveLogger.new 'log/development.log', keep: 30, size: 10
|
46
|
+
logger.info 'test'
|
47
|
+
```
|
48
|
+
|
49
|
+
where:
|
50
|
+
* filename - full path to logfile for writing
|
51
|
+
* keep - count of files for keeping
|
52
|
+
* size - maximum bytes for one file
|
26
53
|
|
27
54
|
## Development
|
28
55
|
|
@@ -32,8 +59,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
59
|
|
33
60
|
## Contributing
|
34
61
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
-
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jurrick/active_logger.
|
37
63
|
|
38
64
|
## License
|
39
65
|
|
data/Rakefile
CHANGED
data/active_logger.gemspec
CHANGED
@@ -9,12 +9,12 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ['jurianp@gmail.com']
|
10
10
|
|
11
11
|
spec.summary = 'Logger based on ActiveSupport::Logger'
|
12
|
-
|
12
|
+
spec.homepage = 'https://github.com/jurrick/active_logger'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
18
18
|
# spec.metadata['changelog_uri'] = 'TODO: Put your gem\'s CHANGELOG.md URL here.'
|
19
19
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
@@ -25,4 +25,6 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.bindir = 'exe'
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
27
|
spec.require_paths = ['lib']
|
28
|
+
|
29
|
+
spec.add_runtime_dependency('activesupport', '>= 5.0.0')
|
28
30
|
end
|
data/bin/console
CHANGED
data/lib/active_logger.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'active_support/logger'
|
4
4
|
|
5
5
|
module ActiveLogger # :nodoc:
|
6
|
+
class << self
|
7
|
+
def new(*args, &block)
|
8
|
+
ActiveLogger::Logger.new(*args, &block)
|
9
|
+
end
|
10
|
+
end
|
6
11
|
end
|
12
|
+
|
13
|
+
require File.dirname(__FILE__) + '/active_logger/logger'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveLogger
|
4
|
+
module Logger # :nodoc:
|
5
|
+
class AdapterNotFound < StandardError; end
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def new(*args, &_block)
|
9
|
+
# extract options
|
10
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
11
|
+
|
12
|
+
setup(args.first, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def setup(type, options)
|
16
|
+
case type
|
17
|
+
when :stdout, STDOUT
|
18
|
+
ActiveSupport::Logger.new(STDOUT)
|
19
|
+
when :stderr, STDERR
|
20
|
+
ActiveSupport::Logger.new(STDERR)
|
21
|
+
when String, Pathname
|
22
|
+
ActiveSupport::Logger.new(type.to_s, options[:keep], options[:size])
|
23
|
+
when :file
|
24
|
+
ActiveSupport::Logger.new(options[:filename], options[:keep], options[:size])
|
25
|
+
else
|
26
|
+
raise AdapterNotFound
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/log/.keep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Snegirev
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-04-19 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.0.0
|
13
27
|
description:
|
14
28
|
email:
|
15
29
|
- jurianp@gmail.com
|
@@ -20,6 +34,8 @@ files:
|
|
20
34
|
- ".editorconfig"
|
21
35
|
- ".gitignore"
|
22
36
|
- ".rspec"
|
37
|
+
- ".rubocop.yml"
|
38
|
+
- ".rubocop_todo.yml"
|
23
39
|
- ".travis.yml"
|
24
40
|
- Gemfile
|
25
41
|
- Gemfile.lock
|
@@ -30,11 +46,15 @@ files:
|
|
30
46
|
- bin/console
|
31
47
|
- bin/setup
|
32
48
|
- lib/active_logger.rb
|
49
|
+
- lib/active_logger/logger.rb
|
33
50
|
- lib/active_logger/version.rb
|
34
|
-
|
51
|
+
- log/.keep
|
52
|
+
homepage: https://github.com/jurrick/active_logger
|
35
53
|
licenses:
|
36
54
|
- MIT
|
37
|
-
metadata:
|
55
|
+
metadata:
|
56
|
+
homepage_uri: https://github.com/jurrick/active_logger
|
57
|
+
source_code_uri: https://github.com/jurrick/active_logger
|
38
58
|
post_install_message:
|
39
59
|
rdoc_options: []
|
40
60
|
require_paths:
|