log4ever 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lib/log4r/evernote.rb +8 -1
- data/lib/log4r/outputter/evernoteoutputter.rb +13 -14
- data/log4ever.gemspec +1 -1
- metadata +4 -7
- data/gem/log4ever-0.0.1.gem +0 -0
- data/gem/log4ever-0.0.2.gem +0 -0
- data/gem/log4ever-0.0.3.gem +0 -0
data/README.md
CHANGED
data/lib/log4r/evernote.rb
CHANGED
@@ -15,7 +15,7 @@ require "Evernote/EDAM/note_store"
|
|
15
15
|
require "Evernote/EDAM/limits_constants.rb"
|
16
16
|
|
17
17
|
module Log4ever
|
18
|
-
VERSION = '0.0.
|
18
|
+
VERSION = '0.0.5'
|
19
19
|
class TypeError < StandardError; end
|
20
20
|
module ShiftAge
|
21
21
|
DAILY = 1
|
@@ -231,6 +231,13 @@ module Log4r
|
|
231
231
|
@note
|
232
232
|
end
|
233
233
|
|
234
|
+
# get created time
|
235
|
+
def created_at
|
236
|
+
time = @note.created.to_s
|
237
|
+
ut = time.slice(0, time.length - 3)
|
238
|
+
Time.at(ut.to_f)
|
239
|
+
end
|
240
|
+
|
234
241
|
# get note content text
|
235
242
|
def content
|
236
243
|
return @content_ unless @content_.nil?
|
@@ -18,9 +18,6 @@ module Log4r
|
|
18
18
|
|
19
19
|
# validation of evernote parameters
|
20
20
|
def validate(hash)
|
21
|
-
set_maxsize(hash) # for rolling
|
22
|
-
set_shift_age(hash) # for roling
|
23
|
-
|
24
21
|
env = hash[:env] || hash['env'] || 'sandbox'
|
25
22
|
if env == 'sandbox'
|
26
23
|
@env = "https://#{SANDBOX_HOST}/edam/user"
|
@@ -31,19 +28,21 @@ module Log4r
|
|
31
28
|
end
|
32
29
|
@auth_token = hash[:auth_token] || hash['auth_token'] || ""
|
33
30
|
raise ArgumentError, "Must specify from auth token" if @auth_token.empty?
|
31
|
+
notebook_name = hash[:notebook] || hash['notebook'] || ""
|
32
|
+
stack_name = hash[:stack] || hash['stack']
|
33
|
+
raise ArgumentError, "Must specify from notebook" if @notebook_name.empty?
|
34
34
|
@evernote = MyEvernote.new(@env, @auth_token)
|
35
|
-
notebook = hash[:notebook] || hash['notebook'] || ""
|
36
|
-
raise ArgumentError, "Must specify from notebook" if notebook.empty?
|
37
35
|
tags = @evernote.get_tags(hash[:tags] || hash['tags'] || [])
|
38
|
-
|
39
|
-
@
|
40
|
-
@notebook = @evernote.get_notebook(notebook, stack)
|
41
|
-
@note = @evernote.get_note(@notebook)
|
36
|
+
notebook = @evernote.get_notebook(notebook_name, stack_name)
|
37
|
+
@note = @evernote.get_note(notebook)
|
42
38
|
@tags = tags.map{|tag_obj| tag_obj.guid}
|
39
|
+
set_maxsize(hash) # for rolling
|
40
|
+
set_shift_age(hash) # for rolling
|
43
41
|
end
|
44
42
|
|
45
43
|
def canonical_log(logevent); super end
|
46
44
|
|
45
|
+
# write log
|
47
46
|
def write(content)
|
48
47
|
if note_size_requires_roll? || time_requires_roll?
|
49
48
|
create_log(content)
|
@@ -76,7 +75,7 @@ module Log4r
|
|
76
75
|
@note.size == 0 || (@maxsize > 0 && @note.size >= @maxsize)
|
77
76
|
end
|
78
77
|
|
79
|
-
# whether or not to rotate
|
78
|
+
# whether or not to rotate
|
80
79
|
def time_requires_roll?
|
81
80
|
!@endTime.nil? && Time.now.to_i >= @endTime
|
82
81
|
end
|
@@ -121,16 +120,16 @@ module Log4r
|
|
121
120
|
Log4ever::ShiftAge::MONTHLY].include? _shift_age
|
122
121
|
raise TypeError, "Argument 'shift_age' must be > 0", caller
|
123
122
|
end
|
124
|
-
|
123
|
+
created_at = @note.created_at
|
125
124
|
case _shift_age
|
126
125
|
when Log4ever::ShiftAge::DAILY
|
127
|
-
tomorrow = Time.local(
|
126
|
+
tomorrow = Time.local(created_at.tomorrow.year, created_at.tomorrow.month, created_at.tomorrow.day)
|
128
127
|
@endTime = tomorrow.to_i
|
129
128
|
when Log4ever::ShiftAge::WEEKLY
|
130
|
-
next_week = Time.local(
|
129
|
+
next_week = Time.local(created_at.next_week.year, created_at.next_week.month, created_at.next_week.day)
|
131
130
|
@endTime = next_week.to_i
|
132
131
|
when Log4ever::ShiftAge::MONTHLY
|
133
|
-
next_month = Time.local(
|
132
|
+
next_month = Time.local(created_at.next_month.year, created_at.next_month.month, created_at.next_month.day)
|
134
133
|
@endTime = next_month.to_i
|
135
134
|
else
|
136
135
|
raise TypeError, "Argument 'shift_age' must be '1' or '2' or '3'", caller
|
data/log4ever.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log4ever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-29 00:00:00.000000000 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: log4r
|
17
|
-
requirement: &
|
17
|
+
requirement: &2160928800 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: 1.1.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2160928800
|
26
26
|
description: log4ever is simple logger for evernote. It is available as an extension
|
27
27
|
of log4r.
|
28
28
|
email:
|
@@ -39,9 +39,6 @@ files:
|
|
39
39
|
- Rakefile
|
40
40
|
- config/evernote.auth.test.yml
|
41
41
|
- config/log4r.xml
|
42
|
-
- gem/log4ever-0.0.1.gem
|
43
|
-
- gem/log4ever-0.0.2.gem
|
44
|
-
- gem/log4ever-0.0.3.gem
|
45
42
|
- lib/log4r/evernote.rb
|
46
43
|
- lib/log4r/evernote/lib/Evernote/EDAM/errors_constants.rb
|
47
44
|
- lib/log4r/evernote/lib/Evernote/EDAM/errors_types.rb
|
data/gem/log4ever-0.0.1.gem
DELETED
Binary file
|
data/gem/log4ever-0.0.2.gem
DELETED
Binary file
|
data/gem/log4ever-0.0.3.gem
DELETED
Binary file
|