hatchet-hipchat 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ff61118ae9db2c3297724c40d6d479fdde61f218
|
4
|
+
data.tar.gz: bd3f77f141cb48f46511eedbd3335e951a63c1fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a267a85608c987748fb716a5489df8a8379ee0aec7cf81dea8d9673038841a58270ddf3273028be150610c180f5a8dd6637d2b650bc0e678c61b75ff40a6a86d
|
7
|
+
data.tar.gz: b63f6cecb89352873b72d94eb8fa741ddcb0463ffa629d18a29e0ac6f58cf1356535839055f921507037d88b3ab966bc92f49339980142328e77c10bd7dd20d5
|
@@ -13,7 +13,13 @@ module Hatchet
|
|
13
13
|
|
14
14
|
# Internal: Map for log level to message color.
|
15
15
|
#
|
16
|
-
COLOR_MAP = {
|
16
|
+
COLOR_MAP = {
|
17
|
+
:debug => 'gray',
|
18
|
+
:info => 'gray',
|
19
|
+
:warn => 'yellow',
|
20
|
+
:error => 'red',
|
21
|
+
:fatal => 'red'
|
22
|
+
}
|
17
23
|
|
18
24
|
# Public: The formatter used to format messages before sending them to the
|
19
25
|
# HipChat room.
|
@@ -14,17 +14,28 @@ module Hatchet
|
|
14
14
|
# Emoticon reference: http://hipchat-emoticons.heroku.com/
|
15
15
|
#
|
16
16
|
class HipChatEmoticonFormatter
|
17
|
+
include BacktraceFormatter
|
17
18
|
|
18
19
|
# Internal: Map for converting levels to emoticons.
|
19
20
|
#
|
20
21
|
LEVEL_EMOTICON_MAP = {
|
21
|
-
debug
|
22
|
-
info
|
23
|
-
warn
|
24
|
-
error
|
25
|
-
fatal
|
22
|
+
:debug => '(content)',
|
23
|
+
:info => '(wat)',
|
24
|
+
:warn => '(ohcrap)',
|
25
|
+
:error => '(omg)',
|
26
|
+
:fatal => '(boom)'
|
26
27
|
}
|
27
28
|
|
29
|
+
# Internal: The number of line to limit backtraces to by default.
|
30
|
+
#
|
31
|
+
DEFAULT_BACKTRACE_LIMIT = 4
|
32
|
+
|
33
|
+
# Public: Creates a new instance.
|
34
|
+
#
|
35
|
+
def initialize(args = {})
|
36
|
+
backtrace_limit = args.fetch(:backtrace_limit, DEFAULT_BACKTRACE_LIMIT)
|
37
|
+
end
|
38
|
+
|
28
39
|
# Public: Returns the formatted message with HipChat emoticons in place of
|
29
40
|
# the level.
|
30
41
|
#
|
@@ -46,11 +57,14 @@ module Hatchet
|
|
46
57
|
#
|
47
58
|
def format(level, context, message)
|
48
59
|
msg = message.to_s.strip
|
60
|
+
|
49
61
|
if message.ndc.any?
|
50
|
-
"#{LEVEL_EMOTICON_MAP[level]} - #{context} #{message.ndc.join(' ')} - #{msg}"
|
62
|
+
msg = "#{LEVEL_EMOTICON_MAP[level]} - #{context} #{message.ndc.join(' ')} - #{msg}"
|
51
63
|
else
|
52
|
-
"#{LEVEL_EMOTICON_MAP[level]} - #{context} - #{msg}"
|
64
|
+
msg = "#{LEVEL_EMOTICON_MAP[level]} - #{context} - #{msg}"
|
53
65
|
end
|
66
|
+
|
67
|
+
with_backtrace(message, msg)
|
54
68
|
end
|
55
69
|
|
56
70
|
end
|
@@ -46,14 +46,12 @@ describe HipChatAppender do
|
|
46
46
|
describe 'setting name' do
|
47
47
|
before do
|
48
48
|
subject.name = 'CustomName'
|
49
|
-
end
|
50
|
-
|
51
|
-
before do
|
52
49
|
subject.add :warn, 'Custom::Context', Message.new('Hello, World')
|
53
50
|
end
|
54
51
|
|
55
52
|
it 'sends a message with the configured name' do
|
56
|
-
assert 'CustomName' == message.from
|
53
|
+
assert 'CustomName' == message.from,
|
54
|
+
"expected '#{message.from}' to equal 'CustomName'"
|
57
55
|
end
|
58
56
|
end
|
59
57
|
|
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hatchet-hipchat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Garry Shutler
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-05 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: hatchet
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 0.2.8
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.8
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: hipchat-api
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 1.0.4
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.4
|
36
41
|
description: Hatchet appender that sends messages to HipChat
|
37
42
|
email:
|
38
43
|
- garry@robustsoftware.co.uk
|
@@ -40,38 +45,37 @@ executables: []
|
|
40
45
|
extensions: []
|
41
46
|
extra_rdoc_files: []
|
42
47
|
files:
|
48
|
+
- LICENSE
|
49
|
+
- lib/hatchet-hipchat.rb
|
43
50
|
- lib/hatchet-hipchat/hipchat_appender.rb
|
44
51
|
- lib/hatchet-hipchat/hipchat_emoticon_formatter.rb
|
45
52
|
- lib/hatchet-hipchat/version.rb
|
46
|
-
- lib/hatchet-hipchat.rb
|
47
53
|
- spec/helpers/fake_client.rb
|
48
54
|
- spec/hipchat_appender_spec.rb
|
49
55
|
- spec/hipchat_emoticon_formatter_spec.rb
|
50
56
|
- spec/spec_helper.rb
|
51
|
-
- LICENSE
|
52
57
|
homepage: https://github.com/gshutler/hatchet-hipchat
|
53
58
|
licenses: []
|
59
|
+
metadata: {}
|
54
60
|
post_install_message:
|
55
61
|
rdoc_options: []
|
56
62
|
require_paths:
|
57
63
|
- lib
|
58
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
65
|
requirements:
|
61
|
-
- -
|
66
|
+
- - '>='
|
62
67
|
- !ruby/object:Gem::Version
|
63
68
|
version: '0'
|
64
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
70
|
requirements:
|
67
|
-
- -
|
71
|
+
- - '>='
|
68
72
|
- !ruby/object:Gem::Version
|
69
73
|
version: '0'
|
70
74
|
requirements: []
|
71
75
|
rubyforge_project:
|
72
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.2.2
|
73
77
|
signing_key:
|
74
|
-
specification_version:
|
78
|
+
specification_version: 4
|
75
79
|
summary: Hatchet appender that sends messages to HipChat
|
76
80
|
test_files:
|
77
81
|
- spec/helpers/fake_client.rb
|