scrolls 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/scrolls.rb +29 -8
- data/lib/scrolls/version.rb +1 -1
- data/scrolls.gemspec +2 -2
- metadata +4 -4
data/lib/scrolls.rb
CHANGED
@@ -10,14 +10,13 @@ module Scrolls
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def log_exception(data, e)
|
13
|
-
Log.log_exception(data,
|
13
|
+
Log.log_exception(data, e)
|
14
14
|
end
|
15
15
|
|
16
16
|
module Log
|
17
17
|
extend self
|
18
18
|
|
19
19
|
def start
|
20
|
-
$stdout.sync = $stderr.sync = true
|
21
20
|
log(:log => true, :start => true)
|
22
21
|
end
|
23
22
|
|
@@ -25,11 +24,22 @@ module Scrolls
|
|
25
24
|
@mtx ||= Mutex.new
|
26
25
|
end
|
27
26
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
def sync_stdout
|
28
|
+
$stdout.sync = true
|
29
|
+
$stdout
|
30
|
+
end
|
31
|
+
|
32
|
+
def sync_stderr
|
33
|
+
$stderr.sync = true
|
34
|
+
$stderr
|
35
|
+
end
|
36
|
+
|
37
|
+
def stdout
|
38
|
+
@stdout ||= sync_stdout
|
39
|
+
end
|
40
|
+
|
41
|
+
def stderr
|
42
|
+
@stderr ||= sync_stderr
|
33
43
|
end
|
34
44
|
|
35
45
|
def unparse(data)
|
@@ -81,7 +91,8 @@ module Scrolls
|
|
81
91
|
:message => e.message,
|
82
92
|
:exception_id => e.object_id.abs
|
83
93
|
))
|
84
|
-
e.backtrace.reverse
|
94
|
+
bt = e.backtrace.reverse
|
95
|
+
bt[0, bt.size-6].each do |line|
|
85
96
|
log(data.merge(
|
86
97
|
:exception => true,
|
87
98
|
:exception_id => e.object_id.abs,
|
@@ -89,5 +100,15 @@ module Scrolls
|
|
89
100
|
))
|
90
101
|
end
|
91
102
|
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def write(data, output=stdout)
|
107
|
+
msg = unparse(data)
|
108
|
+
mtx.synchronize do
|
109
|
+
output.puts(msg)
|
110
|
+
output.flush
|
111
|
+
end
|
112
|
+
end
|
92
113
|
end
|
93
114
|
end
|
data/lib/scrolls/version.rb
CHANGED
data/scrolls.gemspec
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path('../lib/scrolls/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Heroku"]
|
6
6
|
gem.email = ["curt@heroku.com"]
|
7
|
-
gem.description = "
|
7
|
+
gem.description = "Logging, easier, more consistent."
|
8
8
|
gem.summary = "When do we log? All the time."
|
9
|
-
gem.homepage = "https://github.com/
|
9
|
+
gem.homepage = "https://github.com/asenchi/scrolls"
|
10
10
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
11
11
|
gem.files = `git ls-files`.split("\n")
|
12
12
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrolls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,9 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
14
|
+
description: Logging, easier, more consistent.
|
15
15
|
email:
|
16
16
|
- curt@heroku.com
|
17
17
|
executables: []
|
@@ -26,7 +26,7 @@ files:
|
|
26
26
|
- lib/scrolls.rb
|
27
27
|
- lib/scrolls/version.rb
|
28
28
|
- scrolls.gemspec
|
29
|
-
homepage: https://github.com/
|
29
|
+
homepage: https://github.com/asenchi/scrolls
|
30
30
|
licenses: []
|
31
31
|
post_install_message:
|
32
32
|
rdoc_options: []
|