spine-logging 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c9b37d59d10c3c05e27ef1d6bbf623dce9e4a1fd
4
+ data.tar.gz: 930804faa8db7873d9a5422148d032e7e7cf6179
5
+ SHA512:
6
+ metadata.gz: 2c35574cd80fad9ee990eabbfd328e1d3171db6396a34ebee71dc6c53a2f988252cb0b231b1e5a7137b0fdcffb81e5f238daff5263128951fa427047877fe76a
7
+ data.tar.gz: 1790008d64946cb625a50d56aa539704f9782bdea5958bfbd6c61941e138d8293aa0f80e79ddd1861da9a66ff30e989a03433af21d8e28e77d7d6647f9a29871
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /bin/
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ Changelog
2
+ =========
3
+
4
+ 0.1.1
5
+ -----
6
+ - Adds summary
7
+
8
+ 0.1.0
9
+ -----
10
+ - First public release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in spine-logging.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spine-logging (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ codeclimate-test-reporter (0.4.7)
10
+ simplecov (>= 0.7.1, < 1.0.0)
11
+ diff-lcs (1.2.5)
12
+ docile (1.1.5)
13
+ json (1.8.2)
14
+ rake (10.4.2)
15
+ rspec (3.2.0)
16
+ rspec-core (~> 3.2.0)
17
+ rspec-expectations (~> 3.2.0)
18
+ rspec-mocks (~> 3.2.0)
19
+ rspec-core (3.2.3)
20
+ rspec-support (~> 3.2.0)
21
+ rspec-expectations (3.2.1)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.2.0)
24
+ rspec-mocks (3.2.1)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.2.0)
27
+ rspec-support (3.2.2)
28
+ simplecov (0.10.0)
29
+ docile (~> 1.1.0)
30
+ json (~> 1.8)
31
+ simplecov-html (~> 0.10.0)
32
+ simplecov-html (0.10.0)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ bundler (~> 1.7)
39
+ codeclimate-test-reporter (~> 0.4)
40
+ rake (~> 10.0)
41
+ rspec (~> 3.2)
42
+ spine-logging!
data/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2015, TOGGL LLC
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ 3. Neither the name of the TOGGL LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Spine::Logging
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/spine-logging.svg)](http://badge.fury.io/rb/spine-logging)
4
+ [![Dependency Status](https://gemnasium.com/rspine/logging.svg)](https://gemnasium.com/rspine/logging)
5
+ [![Code Climate](https://codeclimate.com/github/rspine/logging/badges/gpa.svg)](https://codeclimate.com/github/rspine/logging)
6
+
7
+ Formatters for logger.
8
+
9
+ ## Installation
10
+
11
+ To install it, add the gem to your Gemfile:
12
+
13
+ ```ruby
14
+ gem 'spine-logging'
15
+ ```
16
+
17
+ Then run `bundle`. If you're not using Bundler, just `gem install spine-logging`.
18
+
19
+ ## Usage
20
+
21
+ ```ruby
22
+ logger = Spine::Logging.get('development')
23
+ logger.info('Hey')
24
+ # [INFO 2015-05-27T10:35:27.377Z #9883] Hey
25
+ ```
26
+
27
+ It is also possible to add stream for logging:
28
+
29
+ ```ruby
30
+ logger = Spine::Logging.prepare(STDOUT)
31
+ ```
32
+
33
+ or getting standard output:
34
+
35
+ ```ruby
36
+ logger = Spine::Logging.output
37
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,10 @@
1
+ module Spine
2
+ module Logging
3
+ autoload :Logs, 'spine/logging/logs'
4
+ autoload :NullFormatter, 'spine/logging/null_formatter'
5
+ autoload :ProcessLogFormatter, 'spine/logging/process_log_formatter'
6
+ autoload :Engine, 'spine/logging/engine'
7
+
8
+ extend Logs
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ module Spine
2
+ module Logging
3
+ module Engine
4
+ module Configuration
5
+ def logs
6
+ ::Spine::Logging
7
+ end
8
+
9
+ def logger
10
+ @logger ||= logs.output
11
+ end
12
+ end
13
+
14
+ extend self
15
+
16
+ def configuration
17
+ Configuration
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,47 @@
1
+ require 'logger'
2
+
3
+ module Spine
4
+ module Logging
5
+ module Logs
6
+ def get(name)
7
+ prepare(open_log(name))
8
+ end
9
+
10
+ def prepare(stream)
11
+ log = Logger.new(stream).extend(Extensions)
12
+ log.formatter = ProcessLogFormatter
13
+ log
14
+ end
15
+
16
+ def output
17
+ prepare(STDOUT)
18
+ end
19
+
20
+ def path=(path)
21
+ @path = path
22
+ end
23
+
24
+ def path
25
+ @path
26
+ end
27
+
28
+ private
29
+
30
+ def open_log(name)
31
+ log = File.open(full_path(name), 'a')
32
+ log.sync = true
33
+ log
34
+ end
35
+
36
+ def full_path(name)
37
+ File.join(path, "#{ name }.log").to_s
38
+ end
39
+
40
+ module Extensions
41
+ def write(message)
42
+ info(message)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,11 @@
1
+ module Spine
2
+ module Logging
3
+ module NullFormatter
4
+ extend self
5
+
6
+ def call(severity, timestamp, name, message)
7
+ "#{ message }\r\n"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Spine
2
+ module Logging
3
+ module ProcessLogFormatter
4
+ extend self
5
+
6
+ def call(severity, timestamp, name, message)
7
+ "[#{ severity } #{ timestamp.utc.iso8601(3) } ##{ Process.pid.to_s }] #{ message }\r\n"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Spine
2
+ module Logging
3
+ VERSION = '0.1.1'
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'spine/logging/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "spine-logging"
7
+ spec.version = Spine::Logging::VERSION
8
+ spec.authors = ["TOGGL LLC"]
9
+ spec.email = ["support@toggl.com"]
10
+ spec.summary = 'Logging formatters.'
11
+ spec.description = ''
12
+ spec.homepage = 'https://github.com/rspine/logging'
13
+ spec.license = 'BSD-3-Clause'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency 'bundler', "~> 1.7"
21
+ spec.add_development_dependency 'rake', "~> 10.0"
22
+ spec.add_development_dependency 'rspec', "~> 3.2"
23
+ spec.add_development_dependency 'codeclimate-test-reporter', "~> 0.4"
24
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spine-logging
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - TOGGL LLC
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.4'
69
+ description: ''
70
+ email:
71
+ - support@toggl.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - CHANGELOG.md
78
+ - Gemfile
79
+ - Gemfile.lock
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - lib/spine/logging.rb
84
+ - lib/spine/logging/engine.rb
85
+ - lib/spine/logging/logs.rb
86
+ - lib/spine/logging/null_formatter.rb
87
+ - lib/spine/logging/process_log_formatter.rb
88
+ - lib/spine/logging/version.rb
89
+ - spine-logging.gemspec
90
+ homepage: https://github.com/rspine/logging
91
+ licenses:
92
+ - BSD-3-Clause
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.4.5
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Logging formatters.
114
+ test_files: []