teelogger 0.4.0 → 0.4.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: 895f6e899d661222b23023e1ad0ebc7a57578b6a
4
- data.tar.gz: 7ebdb6eeb7aee0fa333638951b6b8cff677b8f37
3
+ metadata.gz: a05f90f38dfc709f361c48700fd75abc7b4cae97
4
+ data.tar.gz: 21adf664c10e60ff5788c4b1b6b782cda65158ca
5
5
  SHA512:
6
- metadata.gz: 4da6b7652981ab639c5a3e728c3dce879a2db89ec4b81c4a5d8be960132cb047eee34d3c9765b4e55f6e847321f333d8690c222ddefbb03dd1dd9f2dae774aa2
7
- data.tar.gz: befc09d315e3e342b7af707c10ec72f8b52a5b8ed8fced762b4ac905b2ae4578dc78f694b0c971d30794394f68b5e8a8e443a9b1ab4e77ea5d94497ebabeabb0
6
+ metadata.gz: 4088feb8ab68f3635e0ae30d88bbefc2ec498c0f6fb3c05b20158b73eeb47ca1253c5c1ba2fe69668f3fcce4dcb103c4b0e96036c0d77e63b91060dccc693605
7
+ data.tar.gz: edcccbf758d9b8cc6b95ae5694ab60869c565062447ccef2fa1b78916a1d67e16e411082f4639135f355c22276fd15e82e4d2563d3c0433b8614c0ba81088a79
data/.travis.yml CHANGED
@@ -9,6 +9,8 @@ language: ruby
9
9
  rvm:
10
10
  - 1.9.3
11
11
  - 2.0.0
12
+ env:
13
+ CODECLIMATE_REPO_TOKEN=e37a93224a40c36fd6a24465c063e7627661921a868a2d1321ad2937d7889de6
12
14
  notifications:
13
15
  email:
14
16
  recipients:
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem "codeclimate-test-reporter", group: :test, require: nil
4
+
3
5
  # Specify your gem's dependencies in teelogger.gemspec
4
6
  gemspec
data/README.md CHANGED
@@ -4,6 +4,8 @@ Mini wrapper around Ruby Logger for logging to multiple destinations.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/teelogger.svg)](http://badge.fury.io/rb/teelogger)
6
6
  [![Build Status](https://travis-ci.org/spriteCloud/teelogger.svg?branch=master)](https://travis-ci.org/spriteCloud/teelogger)
7
+ [![Code Climate](https://codeclimate.com/github/spriteCloud/teelogger/badges/gpa.svg)](https://codeclimate.com/github/spriteCloud/teelogger)
8
+ [![Test Coverage](https://codeclimate.com/github/spriteCloud/teelogger/badges/coverage.svg)](https://codeclimate.com/github/spriteCloud/teelogger)
7
9
 
8
10
  ## Installation
9
11
 
@@ -49,6 +51,23 @@ log.each do |name, logger|
49
51
  end
50
52
  ```
51
53
 
54
+ Unlike the standard Ruby logger, flushing log contents is more deterministic.
55
+ `TeeLogger#flush` flushes not only the Ruby buffers of all loggers, but also
56
+ tries to invoke [IO#fsync](http://ruby-doc.org/core-2.2.1/IO.html#method-i-fsync).
57
+ In addition, `TeeLogger` lets you set a flush interval indicating after how
58
+ many messages logged `TeeLogger#flush` is to be invoked automatically:
59
+
60
+ ```ruby
61
+ require 'teelogger'
62
+
63
+ log = TeeLogger::TeeLogger.new(STDOUT, "filename.log")
64
+ log.flush_interval = 1 # flush every line
65
+ log["filename.log"].flush_interval = 2 # flush every other line
66
+
67
+ log.info "first message" # flushes STDOUT
68
+ log.info "second message" # flushes STDOUT and filename.log
69
+ ```
70
+
52
71
  ## Contributing
53
72
 
54
73
  1. Fork it ( https://github.com/[my-github-username]/teelogger/fork )
@@ -73,3 +73,20 @@ Feature: Logger
73
73
  | ERROR |
74
74
  | FATAL |
75
75
 
76
+ @logger_06
77
+ Scenario Outline: Exception logging
78
+ Given I create a TeeLogger with an IO object
79
+ And I set the log level to "<level>"
80
+ And I log an exception
81
+ Then I expect the log level "<level>" to have taken hold
82
+ And I expect the log message to <appear> in the IO object
83
+
84
+ Examples:
85
+ | level | appear |
86
+ | DEBUG | appear |
87
+ | INFO | appear |
88
+ | WARN | appear |
89
+ | ERROR | appear |
90
+ | FATAL | not appear |
91
+
92
+
@@ -52,10 +52,6 @@ Given(/^I create a TeeLogger with an IO object$/) do
52
52
  logger = TeeLogger::TeeLogger.new io
53
53
  end
54
54
 
55
- Then(/^I expect the log message to appear in the IO object$/) do
56
- assert io.string.include?(message), "Test message '#{message}' not included in output."
57
- end
58
-
59
55
  Given(/^I create a TeeLogger with multiple loggers$/) do
60
56
  args = []
61
57
  3.times do
@@ -71,3 +67,25 @@ Then(/^I expect the class to let me access all loggers like a hash$/) do
71
67
  end
72
68
  end
73
69
 
70
+
71
+ Given(/^I log an exception$/) do
72
+ begin
73
+ raise "Some error"
74
+ rescue StandardError => err
75
+ message = "@@EXCEPTION@@"
76
+ logger.exception(message, err)
77
+ end
78
+ end
79
+
80
+ Then(/^I expect the log message to (.*?) in the IO object$/) do |appear|
81
+ appear.strip!
82
+ case appear
83
+ when "appear"
84
+ assert io.string.include?(message), "Test message '#{message}' not included in output."
85
+ when "not appear"
86
+ assert !io.string.include?(message), "Test message '#{message}' included in output, didn't expect that!"
87
+ else
88
+ raise "Not implemented: appear == '#{appear}'"
89
+ end
90
+ end
91
+
@@ -1 +1,4 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
1
4
  require "teelogger"
@@ -6,5 +6,5 @@
6
6
  # All rights reserved.
7
7
  #
8
8
  module TeeLogger
9
- VERSION = "0.4.0"
9
+ VERSION = "0.4.1"
10
10
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teelogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Finkhaeuser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-27 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cucumber
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Mini wrapper around Ruby Logger for logging to multiple destinations.
@@ -73,8 +73,8 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".gitignore"
77
- - ".travis.yml"
76
+ - .gitignore
77
+ - .travis.yml
78
78
  - Gemfile
79
79
  - LICENSE
80
80
  - README.md
@@ -95,12 +95,12 @@ require_paths:
95
95
  - lib
96
96
  required_ruby_version: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - ">="
98
+ - - '>='
99
99
  - !ruby/object:Gem::Version
100
100
  version: '0'
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - ">="
103
+ - - '>='
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []