kcaco 0.0.1 → 0.0.2
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.
- data/Gemfile.lock +1 -1
- data/README.md +22 -2
- data/examples/block.rb +22 -0
- data/lib/kcaco.rb +1 -0
- data/lib/kcaco/file_writer.rb +1 -0
- data/lib/kcaco/version.rb +1 -1
- data/lib/kcaco/wrapped_exception.rb +1 -1
- data/pkg/kcaco-0.0.1.gem +0 -0
- metadata +5 -3
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -42,6 +42,25 @@ write out the exception object to `Kcaco.save_path` in a file named
|
|
42
42
|
the same as that GUID. You can disable the save behavior with
|
43
43
|
`Kcaco.auto_save = false`.
|
44
44
|
|
45
|
+
### Payloads
|
46
|
+
|
47
|
+
If you have additional information to store, you can do so by parsing
|
48
|
+
in a payload with the block syntax (`examples/block.rb`).
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
Kcaco.pretty(exception) { "payload" }
|
52
|
+
```
|
53
|
+
|
54
|
+
This will not affect the logged message but will write out the payload
|
55
|
+
in the saved exception. This can be useful if you want to store
|
56
|
+
state. For example, if your application is processing a queue and you
|
57
|
+
got an exception, you could store the queue message that triggered the
|
58
|
+
error in the payload for later debugging.
|
59
|
+
|
60
|
+
### Customize log message
|
61
|
+
|
62
|
+
TBD.
|
63
|
+
|
45
64
|
## Example
|
46
65
|
|
47
66
|
$ bundle exec examples/simple.rb
|
@@ -109,14 +128,15 @@ have to run with verbose logging:
|
|
109
128
|
D, [2012-01-06T16:28:33.903784 #736] DEBUG -- : examples/no_kcaco_different_levels.rb:10:in `explosions'
|
110
129
|
D, [2012-01-06T16:28:33.903814 #736] DEBUG -- : examples/no_kcaco_different_levels.rb:17
|
111
130
|
|
112
|
-
Or you can roll your own smarts. Repeatedly. Or just use
|
131
|
+
Or you can roll your own smarts. Repeatedly. Or just use something
|
132
|
+
like Kcaco. Quite simply what it does is:
|
113
133
|
|
114
134
|
* Save you having to format the log message by doing it for you.
|
115
135
|
* Write more detail to a separate file where you can inspect it later.
|
116
136
|
|
117
137
|
.. and you get
|
118
138
|
|
119
|
-
bundle exec examples/simple.rb
|
139
|
+
$ bundle exec examples/simple.rb
|
120
140
|
E, [2012-01-06T16:29:50.730922 #793] ERROR -- : ae58d80f-4bc3-899a-fd0b-2c831833510c MichaelBay::Boom: ba da bloom [simple.rb L11]
|
121
141
|
|
122
142
|
In this example, you could see the saved exception
|
data/examples/block.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "logger"
|
4
|
+
require "kcaco"
|
5
|
+
|
6
|
+
class MichaelBay
|
7
|
+
|
8
|
+
class Boom < RuntimeError; end
|
9
|
+
|
10
|
+
def explosions
|
11
|
+
raise Boom.new("ba da bloom")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
if __FILE__ == $0
|
16
|
+
logger = Logger.new(STDOUT)
|
17
|
+
begin
|
18
|
+
MichaelBay.new.explosions
|
19
|
+
rescue => e
|
20
|
+
logger.error Kcaco.pretty(e) { "custom payload" }
|
21
|
+
end
|
22
|
+
end
|
data/lib/kcaco.rb
CHANGED
data/lib/kcaco/file_writer.rb
CHANGED
data/lib/kcaco/version.rb
CHANGED
data/pkg/kcaco-0.0.1.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kcaco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marc Bowes
|
@@ -71,10 +71,12 @@ extra_rdoc_files: []
|
|
71
71
|
|
72
72
|
files:
|
73
73
|
- examples/no_kcaco_different_levels.rb
|
74
|
+
- examples/block.rb
|
74
75
|
- examples/simple.rb
|
75
76
|
- examples/no_kcaco_one_line.rb
|
76
77
|
- Rakefile
|
77
78
|
- README.md
|
79
|
+
- pkg/kcaco-0.0.1.gem
|
78
80
|
- Gemfile
|
79
81
|
- kcaco.gemspec
|
80
82
|
- spec/support/boom.rb
|