log4ever 0.1.5 → 0.1.6

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: 45ccb7dce4c1abba539b3fed3173d955ff910090
4
- data.tar.gz: 535bc6d931b3934a4558d7a76dd9cecdec8dd5e2
3
+ metadata.gz: 14736bc1c2d94f19567e5e145ceca8e69d658a92
4
+ data.tar.gz: 682b8ba3c7329ccce4b74dff5ef266800d29747d
5
5
  SHA512:
6
- metadata.gz: 445d7adcc42c86df9583c9fda61ac7dd69ca6c497415a11d246df6337e0d82bd238c96af5e54250de802b29e2788d59c0edd89a008c12b4386b3d56dfa0be566
7
- data.tar.gz: 8d1acff1092c8dbf5643ffb262ab7bd74a052dad4d1f914e58e6bf0e4db8014095212953e49fcdbd99fefc99f3d4deeaad49e3c30f1f9b48fce907ab68bb3473
6
+ metadata.gz: e39d5dd19231d2a9278ebf96cc6e9159f35ab073b2f0d8efc23f468aa5b8b8af76d1194309620100d8c75f5be108b92a30941fcd85e1f1ccb883d1391345a48f
7
+ data.tar.gz: b393ed92c534510f91dd0b6b1c195ca0d97cbea01ca288daf4625c10ee859ba714e977847ec6a304574aa74928791025c1864713f70798f9a35edb7dd8e95fe1
data/README.md CHANGED
@@ -1,43 +1,50 @@
1
- #log4ever
1
+ # log4ever
2
+
2
3
  log4ever is simple logger for evernote. It is available as an extension of [log4r](http://log4r.rubyforge.org/).
3
4
  ***
4
- ###Install
5
- $> gem install log4ever
5
+ ### Install
6
+ ```
7
+ $> gem install log4ever
8
+ ```
6
9
 
7
- ###Usage
8
- # -*- coding: utf-8 -*-
9
- require 'log4r'
10
- require 'log4r/evernote'
10
+ ### Usage
11
+ ```ruby
12
+ # -*- coding: utf-8 -*-
13
+ require 'log4r'
14
+ require 'log4r/evernote'
11
15
 
12
- logger = Log4r::Logger.new("Evernote")
13
- logger.level = Log4r::INFO
14
- formatter = Log4r::PatternFormatter.new(
15
- :pattern => "%d %C[%l]: %M ",
16
- :date_format => "%Y/%m/%d %H:%M:%Sm"
17
- )
18
- stdoutOutputter = Log4r::StdoutOutputter.new('console', {
19
- :formatter => formatter
20
- })
21
- evernoteOutputter = Log4r::EvernoteOutputter.new('evernote', {
22
- :sandbox => false, # Execution environment in Evernote (true: sandbox, false: production, default: production)
23
- :auth_token => "xxxxxxxxxxxxxxxxxxxxxxx", # evernote auth token
24
- :stack => "Log4ever", # evernote stack name
25
- :notebook => "DevelopmentLog", # evernote notebook name
26
- :tags => ['Log'], # evernote tag (Can be specified in the list)
27
- :maxsize => 500, # Maximum size of the logs to be rotated
28
- #:shift_age => Log4ever::ShiftAge::DAILY, # Cycle of the logs to be rotated
29
- :formatter => formatter
30
- })
16
+ logger = Log4r::Logger.new("Evernote")
17
+ logger.level = Log4r::INFO
18
+ formatter = Log4r::PatternFormatter.new(
19
+ :pattern => "%d %C[%l]: %M ",
20
+ :date_format => "%Y/%m/%d %H:%M:%Sm"
21
+ )
22
+ stdoutOutputter = Log4r::StdoutOutputter.new('console', {
23
+ :formatter => formatter
24
+ })
25
+ evernoteOutputter = Log4r::EvernoteOutputter.new('evernote', {
26
+ :sandbox => false, # Execution environment in Evernote (true: sandbox, false: production, default: production)
27
+ :auth_token => "xxxxxxxxxxxxxxxxxxxxxxx", # evernote auth token
28
+ :stack => "Log4ever", # evernote stack name
29
+ :notebook => "DevelopmentLog", # evernote notebook name
30
+ :tags => ['Log'], # evernote tag (Can be specified in the list)
31
+ :maxsize => 500, # Maximum size of the logs to be rotated
32
+ #:shift_age => Log4ever::ShiftAge::DAILY, # Cycle of the logs to be rotated
33
+ :formatter => formatter
34
+ })
31
35
 
32
- logger.outputters = [stdoutOutputter, evernoteOutputter]
33
- logger.info('log output')
34
- Output:
36
+ logger.outputters = [stdoutOutputter, evernoteOutputter]
37
+ logger.info('log output')
38
+ ```
35
39
 
36
- 2012-08-06 21:12:31 Evernote[INFO]: log output
40
+ Output:
41
+ ```
42
+ 2012-08-06 21:12:31 Evernote[INFO]: log output
43
+ ```
37
44
 
38
45
  The output results are stored in Evernote.
39
46
 
40
- ###ChangeLog
47
+ ### ChangeLog
41
48
  * 0.0.1
42
49
  First release.
43
50
  * 0.0.2
@@ -68,7 +75,9 @@ Ruby2.0.0 support. Bug fix.
68
75
  Add testcase.
69
76
  * 0.1.5
70
77
  Performance improvement.
78
+ * 0.1.6
79
+ Ruby2.1.0 support.
71
80
 
72
- ##License
81
+ ## License
73
82
  Licensed under the MIT
74
- http://www.opensource.org/licenses/mit-license.php
83
+ http://www.opensource.org/licenses/mit-license.php
@@ -3,7 +3,7 @@ require 'log4r/outputter/evernoteoutputter'
3
3
  require 'evernote_oauth'
4
4
 
5
5
  module Log4ever
6
- VERSION = '0.1.5'
6
+ VERSION = '0.1.6'
7
7
 
8
8
  class EvernoteError < StandardError; end
9
9
 
@@ -277,4 +277,4 @@ module Log4ever
277
277
  nil
278
278
  end
279
279
  end
280
- end
280
+ end
data/log4ever.gemspec CHANGED
@@ -10,11 +10,10 @@ Gem::Specification.new do |gem|
10
10
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
11
11
  gem.name = "log4ever"
12
12
  gem.require_paths = ["lib"]
13
- gem.add_dependency('log4r', '>= 1.1.10')
14
- gem.add_dependency('activesupport', '>= 4.0.4')
15
- gem.add_dependency('i18n', '>= 0.6.9')
16
- gem.add_dependency('evernote_oauth', '>= 0.2.3')
17
- gem.version = '0.1.5'
13
+ gem.add_dependency 'log4r', '~> 1.1', '>= 1.1.10'
14
+ gem.add_dependency 'activesupport', '~> 4.0', '>= 4.0.4'
15
+ gem.add_dependency 'i18n', '~> 0.6', '>= 0.6.9'
16
+ gem.add_dependency 'evernote_oauth', '~> 0.2', '>= 0.2.3'
17
+ gem.version = '0.1.6'
18
18
  gem.license = 'MIT'
19
19
  end
20
-
@@ -46,9 +46,9 @@ describe Log4ever, 'が実行する処理' do
46
46
  @note = @evernote.note(notebook_obj)
47
47
  write_log = @note.content_xml.children[1].children.reverse[0].text
48
48
  if /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s.*?\[.*?\]:\s(.*)/ =~ write_log
49
- log_content.should == $1.strip
49
+ expect(log_content).to eq($1.strip)
50
50
  else
51
- "".should be_nil
51
+ expect("").to eq(nil) # absolutely failure.
52
52
  end
53
53
  end
54
54
  end
@@ -56,53 +56,54 @@ describe Log4ever, 'が実行する処理' do
56
56
  describe 'Log4rの初期化処理(正常系)' do
57
57
  it 'パラメータのチェックでエラーが出ないこと' do
58
58
  logger.outputters = Log4r::EvernoteOutputter.new(LOGGER_NAME, @params)
59
- logger.name.should == LOGGER_NAME
59
+ expect(logger.name).to eq(LOGGER_NAME)
60
60
  end
61
61
 
62
62
  it 'XMLから読み込んだパラメータのチェックでエラーが出ないこと' do
63
- Log4r::Configurator.load_xml_file(@config_xml).should_not be_nil
63
+ # Log4r::Configurator.load_xml_file(@config_xml).should_not be_nil
64
+ expect(Log4r::Configurator.load_xml_file(@config_xml)).to_not be_nil
64
65
  end
65
66
  end
66
67
 
67
68
  describe 'Log4rの初期化処理(異常系)' do
68
69
  it "sandboxパラメータのチェックでエラーが出ること" do
69
- proc {
70
+ expect {
70
71
  logger.outputters = Log4r::EvernoteOutputter.new(LOGGER_NAME, @params.merge(
71
72
  :sandbox => "aaa"
72
73
  ))
73
- }.should raise_error(ArgumentError)
74
+ }.to raise_error(ArgumentError)
74
75
  end
75
76
 
76
77
  it "auth_token必須パラメータのチェックでエラーが出ること" do
77
- proc {
78
+ expect {
78
79
  logger.outputters = Log4r::EvernoteOutputter.new(LOGGER_NAME, @params.merge(
79
80
  :auth_token => nil
80
81
  ))
81
- }.should raise_error(ArgumentError)
82
+ }.to raise_error(ArgumentError)
82
83
  end
83
84
 
84
85
  it "notebook必須パラメータのチェックでエラーが出ること" do
85
- proc {
86
+ expect {
86
87
  logger.outputters = Log4r::EvernoteOutputter.new(LOGGER_NAME, @params.merge(
87
88
  :notebook => nil
88
89
  ))
89
- }.should raise_error(ArgumentError)
90
+ }.to raise_error(ArgumentError)
90
91
  end
91
92
 
92
93
  it "ログローテートサイズパラメータのチェックでエラーが出ること" do
93
- proc {
94
+ expect {
94
95
  logger.outputters = Log4r::EvernoteOutputter.new(LOGGER_NAME, @params.merge(
95
96
  :maxsize => 0
96
97
  ))
97
- }.should raise_error(TypeError)
98
+ }.to raise_error(TypeError)
98
99
  end
99
100
 
100
101
  it "ログローテート期間パラメータのチェックでエラーが出ること" do
101
- proc {
102
+ expect {
102
103
  logger.outputters = Log4r::EvernoteOutputter.new(LOGGER_NAME, @params.merge(
103
104
  :shift_age => 4
104
105
  ))
105
- }.should raise_error(TypeError)
106
+ }.to raise_error(TypeError)
106
107
  end
107
108
  end
108
109
 
@@ -112,7 +113,7 @@ describe Log4ever, 'が実行する処理' do
112
113
  notebook_name = Time.now.to_i.to_s
113
114
  notebook = @evernote.notebook
114
115
  obj = notebook.get(notebook_name, @params[:stack])
115
- obj.name.should == notebook_name
116
+ expect(obj.name).to eq(notebook_name)
116
117
  end
117
118
 
118
119
  it 'ノートブックが存在しない場合、スタックが新規作成されること' do
@@ -120,14 +121,14 @@ describe Log4ever, 'が実行する処理' do
120
121
  notebook_name = Time.now.to_i.to_s
121
122
  notebook = @evernote.notebook
122
123
  obj = notebook.get(notebook_name, @params[:stack])
123
- obj.stack.should == @params[:stack]
124
+ expect(obj.stack).to eq(@params[:stack])
124
125
  end
125
126
 
126
127
  it '指定したスタックオブジェクト(存在するスタック)を渡した場合、既存のスタックに属するノートブックが取得できること' do
127
128
  @evernote = Log4ever::Evernote.new(@params[:auth_token])
128
129
  @notebook = @evernote.notebook
129
130
  notebook_obj = @notebook.get(@params[:notebook], @params[:stack])
130
- notebook_obj.guid.should_not be_nil
131
+ expect(notebook_obj.guid).to_not be_nil
131
132
  end
132
133
 
133
134
  it '指定したスタックオブジェクト(存在しないスタック)を渡した場合、スタックが新規作成されノートブックが取得できること' do
@@ -136,25 +137,25 @@ describe Log4ever, 'が実行する処理' do
136
137
  notebook_name = Time.now.to_i.to_s
137
138
  stack_name = Time.now.to_i.to_s
138
139
  notebook_obj = @notebook.get(notebook_name, stack_name)
139
- notebook_obj.guid.should_not be_nil
140
+ expect(notebook_obj.guid).to_not be_nil
140
141
  end
141
142
 
142
143
  it '存在するノートブックと同名のノートブックは作成できないこと' do
143
- proc {
144
+ expect {
144
145
  @evernote = Log4ever::Evernote.new(@params[:auth_token])
145
146
  @notebook = @evernote.notebook
146
147
  @notebook.create(@params[:notebook], @params[:stack])
147
- }.should raise_error()
148
+ }.to raise_error(StandardError)
148
149
  end
149
150
 
150
151
  it 'ノートブックの取得に失敗しかつ存在するノートブックと同名のノートブックが指定された場合、作成できないこと' do
151
- proc {
152
+ expect {
152
153
  @evernote = Log4ever::Evernote.new(@params[:auth_token])
153
154
  @notebook = @evernote.notebook
154
155
  stack_name = Time.now.to_i.to_s
155
156
  notebook_obj = @notebook.create(@params[:notebook], stack_name)
156
157
  notebook_obj.should be_nil
157
- }.should raise_error()
158
+ }.to raise_error(StandardError)
158
159
  end
159
160
  end
160
161
 
@@ -167,7 +168,7 @@ describe Log4ever, 'が実行する処理' do
167
168
  @evernote = Log4ever::Evernote.new(@params[:auth_token])
168
169
  notebook = @evernote.notebook
169
170
  note = @evernote.note(notebook.get(@params[:notebook], @params[:stack]))
170
- note.get.tagGuids[0].should_not be_empty
171
+ expect(note.get.tagGuids[0]).to_not be_empty
171
172
  end
172
173
 
173
174
  it '更新対象のノートのタグが増えた場合、新規ノートが作成されること' do
@@ -190,7 +191,7 @@ describe Log4ever, 'が実行する処理' do
190
191
  note = evernote.note(notebook.get(@params[:notebook], @params[:stack])).get
191
192
  guid_after = note.guid
192
193
 
193
- guid_before.should_not == guid_after
194
+ expect(guid_before).to_not eq(guid_after)
194
195
  end
195
196
 
196
197
  it '更新対象のノートのタグが減った場合、新規ノートが作成されること' do
@@ -214,52 +215,52 @@ describe Log4ever, 'が実行する処理' do
214
215
  note = evernote.note(notebook.get(@params[:notebook], @params[:stack])).get
215
216
  guid_after = note.guid
216
217
 
217
- guid_before.should_not == guid_after
218
+ expect(guid_before).to_not eq(guid_after)
218
219
  end
219
220
 
220
221
  it '期間単位でのログローテートを有効にしたとき、エラーが発生しないこと' do
221
- proc {
222
+ expect {
222
223
  logger = Log4r::Logger.new(LOGGER_NAME)
223
224
  @params.delete(:maxsize)
224
225
  @params[:shift_age] = Log4ever::ShiftAge::DAILY
225
226
  evernoteOutputter = Log4r::EvernoteOutputter.new('evernote', @params)
226
227
  logger.outputters = evernoteOutputter
227
228
  logger.info("test1")
228
- }.should_not raise_error()
229
+ }.to_not raise_error
229
230
  end
230
231
 
231
232
  it 'スタックにUTF-8以外の文字列を指定した時、エラーが発生しないこと' do
232
- proc {
233
+ expect {
233
234
  @params[:stack] = "\xA4\xA2\xA4\xA2\xA4\xA2"
234
235
  @params[:notebook] = Time.now.to_i.to_s
235
236
  logger.outputters = Log4r::EvernoteOutputter.new('evernote', @params)
236
237
  logger.debug("test")
237
- }.should_not raise_error()
238
+ }.to_not raise_error
238
239
  end
239
240
 
240
241
  it 'ノートブックにUTF-8以外の文字列を指定した時、エラーが発生しないこと' do
241
- proc {
242
+ expect {
242
243
  @params[:notebook] = "\xA4\xA2" + Time.now.to_i.to_s
243
244
  logger.outputters = Log4r::EvernoteOutputter.new('evernote', @params)
244
245
  logger.debug("test")
245
- }.should_not raise_error()
246
+ }.to_not raise_error
246
247
  end
247
248
 
248
249
  it 'タグにUTF-8以外の文字列を指定した時、エラーが発生しないこと' do
249
- proc {
250
+ expect {
250
251
  @params[:tags] = ['Log', "\x82\xA0\x82\xA0", "\xA4\xA2"]
251
252
  logger.outputters = Log4r::EvernoteOutputter.new('evernote', @params)
252
253
  logger.debug("test")
253
- }.should_not raise_error()
254
+ }.to_not raise_error
254
255
  end
255
256
 
256
257
  it 'ノートにUTF-8以外の文字列を指定した時、エラーが発生しないこと' do
257
- proc {
258
+ expect {
258
259
  logger = Log4r::Logger.new(LOGGER_NAME)
259
260
  logger.outputters = Log4r::EvernoteOutputter.new('evernote', @params)
260
261
  logger.debug("\x82\xA0") # Shift_JIS
261
262
  logger.debug("\xA4\xA2") # EUC-JP
262
- }.should_not raise_error()
263
+ }.to_not raise_error
263
264
  end
264
265
  end
265
- end
266
+ end
metadata CHANGED
@@ -1,69 +1,93 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log4ever
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - mapserver2007
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-09 00:00:00.000000000 Z
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: log4r
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 1.1.10
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - '>='
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
30
+ - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 1.1.10
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - '>='
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
40
+ - - ">="
32
41
  - !ruby/object:Gem::Version
33
42
  version: 4.0.4
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - '>='
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '4.0'
50
+ - - ">="
39
51
  - !ruby/object:Gem::Version
40
52
  version: 4.0.4
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: i18n
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
- - - '>='
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.6'
60
+ - - ">="
46
61
  - !ruby/object:Gem::Version
47
62
  version: 0.6.9
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
52
- - - '>='
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.6'
70
+ - - ">="
53
71
  - !ruby/object:Gem::Version
54
72
  version: 0.6.9
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: evernote_oauth
57
75
  requirement: !ruby/object:Gem::Requirement
58
76
  requirements:
59
- - - '>='
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '0.2'
80
+ - - ">="
60
81
  - !ruby/object:Gem::Version
61
82
  version: 0.2.3
62
83
  type: :runtime
63
84
  prerelease: false
64
85
  version_requirements: !ruby/object:Gem::Requirement
65
86
  requirements:
66
- - - '>='
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.2'
90
+ - - ">="
67
91
  - !ruby/object:Gem::Version
68
92
  version: 0.2.3
69
93
  description: log4ever is simple logger for evernote. It is available as an extension
@@ -74,7 +98,7 @@ executables: []
74
98
  extensions: []
75
99
  extra_rdoc_files: []
76
100
  files:
77
- - .gitignore
101
+ - ".gitignore"
78
102
  - Gemfile
79
103
  - Gemfile.lock
80
104
  - README.md
@@ -96,17 +120,17 @@ require_paths:
96
120
  - lib
97
121
  required_ruby_version: !ruby/object:Gem::Requirement
98
122
  requirements:
99
- - - '>='
123
+ - - ">="
100
124
  - !ruby/object:Gem::Version
101
125
  version: '0'
102
126
  required_rubygems_version: !ruby/object:Gem::Requirement
103
127
  requirements:
104
- - - '>='
128
+ - - ">="
105
129
  - !ruby/object:Gem::Version
106
130
  version: '0'
107
131
  requirements: []
108
132
  rubyforge_project:
109
- rubygems_version: 2.0.14
133
+ rubygems_version: 2.2.0
110
134
  signing_key:
111
135
  specification_version: 4
112
136
  summary: log4ever is simple logger for evernote.