legion-logging 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b48af5c207f2a722ccabf91e15cbc768458d471b
4
- data.tar.gz: 5811756e87a09466d3ba127448184189abfa431f
3
+ metadata.gz: ae78475a7bea256635df87959272baf4bbdeb0e3
4
+ data.tar.gz: e6e405c933b6871bfb7f806f9e6ebd5f37e77175
5
5
  SHA512:
6
- metadata.gz: 8b30cca973cc2f82946ffc78d4bfdeb1d7bf0538738b735f0af740a6d084de5164ddbdcb4d3fe55e5673394996b42c02f70608f7ca2473ba266f27ae11e16153
7
- data.tar.gz: a46b40cb3499f88003bf77fcd083b44d3aa92f85b4d26e6f47bc3fb905503fcc7680deb627c8846e3d8ebbf1a106d8e00f244faf5014c63af5731843d5184b87
6
+ metadata.gz: 61a6eb2fa4c498614977fee08dc3967c9d1036a324f043cd70b9e9943a3e0ba00961236483d0d51168160babaf9b13ad70c9c6a21431c9580964cd7c26b25a0f
7
+ data.tar.gz: ddcaecb7edd883c308ef3e65ef5237cd7f8b035da1eff65a2859e3c9968a5b24780e7a2a7de0f9d6e8ebd153688e437b457564b07f656924593a9a0acb7dfca8
data/README.md CHANGED
@@ -23,6 +23,10 @@ Or install it yourself as:
23
23
 
24
24
  This library is utilized by Legion to log messages
25
25
 
26
+ ## Gem
27
+
28
+ This gem can be viewed and download from [RubyGems - Legion-Logging](https://rubygems.org/gems/legion-logging)
29
+
26
30
  ## Development
27
31
 
28
32
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = 'The Legion::Logging class'
12
12
  spec.description = 'Legion Logging is used for logging things'
13
- spec.homepage = 'https://bitbucket.org/whonodes/legion-logging'
13
+ spec.homepage = 'https://bitbucket.org/legion-io/legion-logging'
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
16
  f.match(%r{^(test|spec|features)/})
@@ -20,10 +20,12 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 1'
23
+ spec.add_development_dependency 'codecov'
23
24
  spec.add_development_dependency 'rake', '~> 10.0'
24
25
  spec.add_development_dependency 'rspec', '~> 3.0'
25
- spec.add_development_dependency 'rspec_junit_formatter', '~> 0'
26
- spec.add_development_dependency 'rubocop', '~> 0'
26
+ spec.add_development_dependency 'rspec_junit_formatter'
27
+ spec.add_development_dependency 'rubocop'
28
+ spec.add_development_dependency 'simplecov'
27
29
 
28
30
  spec.add_dependency 'logger', '~> 1.3'
29
31
  spec.add_dependency 'rainbow', '~> 3'
@@ -11,13 +11,40 @@ module Legion
11
11
  attr_accessor :color
12
12
  # Self Class
13
13
  class << self
14
- attr_accessor :logger
15
- @logger = ::Logger.new($stdout)
16
- end
17
- def self.test(message)
18
- start_logger if @logger.nil?
19
- message = Rainbow(message).aliceblue if @color
20
- @logger.debug(message)
14
+ attr_accessor :log, :logger
15
+
16
+ def setup(options = {})
17
+ @log = ::Logger.new($stdout) if options[:log_file].nil?
18
+ @log = ::Logger.new(options[:log_file]) unless options[:log_file].nil?
19
+ log_level(options[:level])
20
+ log_format(options)
21
+
22
+ @log
23
+ end
24
+
25
+ def log_format(_options)
26
+ @log.formatter = proc do |severity, datetime, _progname, msg|
27
+ "[#{datetime}][#{::Process.pid}] #{severity} #{msg}\n"
28
+ end
29
+ end
30
+
31
+ def log_level(level = 'debug')
32
+ if level == 'debug'
33
+ @log.level = ::Logger::DEBUG
34
+ elsif level == 'info'
35
+ @log.level = ::Logger::INFO
36
+ elsif level == 'warn'
37
+ @log.level = ::Logger::WARN
38
+ elsif level == 'error'
39
+ @log.level = ::Logger::ERROR
40
+ elsif level == 'fatal'
41
+ @log.level = ::Logger::FATAL
42
+ end
43
+ end
44
+
45
+ def get(options = {})
46
+ setup(options)
47
+ end
21
48
  end
22
49
 
23
50
  def self.debug(message)
@@ -51,20 +78,11 @@ module Legion
51
78
  end
52
79
 
53
80
  def self.start_logger
54
- daemonize = false
55
-
56
- if daemonize
57
- @color = false
58
- log_location = '/var/log/legion.log'
59
- else
60
- @color = true
61
- log_location = $stdout
62
- end
81
+ @color = true
82
+ log_location = $stdout
63
83
  @logger = Logger.new(log_location)
64
84
  @logger.level = Logger::DEBUG
65
85
  @logger.formatter = proc do |severity, datetime, _progname, msg|
66
- # default
67
- # SeverityID, [DateTime #pid] SeverityLabel -- ProgName: message
68
86
  "[#{datetime}][#{::Process.pid}] #{severity} #{msg}\n"
69
87
  end
70
88
  end
@@ -1,5 +1,5 @@
1
1
  module Legion
2
2
  module Logging
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-29 00:00:00.000000000 Z
11
+ date: 2019-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: codecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,28 +70,42 @@ dependencies:
56
70
  name: rspec_junit_formatter
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  - !ruby/object:Gem::Dependency
@@ -125,7 +153,7 @@ files:
125
153
  - legion-logging.gemspec
126
154
  - lib/legion/logging.rb
127
155
  - lib/legion/logging/version.rb
128
- homepage: https://bitbucket.org/whonodes/legion-logging
156
+ homepage: https://bitbucket.org/legion-io/legion-logging
129
157
  licenses: []
130
158
  metadata: {}
131
159
  post_install_message: