evrone-ci-common 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/evrone/ci/common/tagged_logging.rb +83 -0
- data/lib/evrone/ci/common/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 579927164ce7768743cf28fd6f3885b006f9bcd8
|
|
4
|
+
data.tar.gz: 183e0536a1d8376354cf2d8a8082f01bde60f8bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 398cc75b9af187374cd4b32a038e37727f504e48f3e6494c4daea388f10c65261ddae8f4c78754b236b6ade4551286b3b3466c7b113b19b3e06983c492e0c50b
|
|
7
|
+
data.tar.gz: de201b035a771e8b453af3683ce1b2f14dc93411b2fd4930752ee683ebee46e811438b8e0da506fb828bffba1d70ce7fe22dae9e8377eca53e86f83918218364
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# from activesupport
|
|
2
|
+
|
|
3
|
+
require 'logger'
|
|
4
|
+
|
|
5
|
+
module Evrone
|
|
6
|
+
module CI
|
|
7
|
+
module Common
|
|
8
|
+
module TaggedLogging
|
|
9
|
+
|
|
10
|
+
class Formatter < ::Logger::Formatter
|
|
11
|
+
Format = "[%s] %1s : %s\n"
|
|
12
|
+
|
|
13
|
+
def call(severity, time, progname, msg)
|
|
14
|
+
Format % [format_datetime(time),
|
|
15
|
+
severity[0...1],
|
|
16
|
+
msg2str("#{tags_text}#{msg}")]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def thread_id
|
|
20
|
+
Thread.current.object_id
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def tagged(*tags)
|
|
24
|
+
new_tags = push_tags(*tags)
|
|
25
|
+
yield self
|
|
26
|
+
ensure
|
|
27
|
+
pop_tags(new_tags.size)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def push_tags(*tags)
|
|
31
|
+
tags.flatten.reject{|i| i.to_s.strip.empty? }.tap do |new_tags|
|
|
32
|
+
current_tags.concat new_tags
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def pop_tags(size = 1)
|
|
37
|
+
current_tags.pop size
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def clear_tags!
|
|
41
|
+
current_tags.clear
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def current_tags
|
|
45
|
+
Thread.current[:activesupport_tagged_logging_tags] ||= []
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def tags_text
|
|
51
|
+
tags = current_tags
|
|
52
|
+
if tags.any?
|
|
53
|
+
tags.collect { |tag| "[#{tag}] " }.join
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.new(logger)
|
|
60
|
+
# Ensure we set a default formatter so we aren't extending nil!
|
|
61
|
+
logger.formatter = Formatter.new
|
|
62
|
+
logger.extend(self)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
%w{ push_tags pop_tags clear_tags! }.each do |m|
|
|
66
|
+
define_method m do
|
|
67
|
+
formatter.send(m)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def tagged(*tags)
|
|
72
|
+
formatter.tagged(*tags) { yield self }
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def flush
|
|
76
|
+
clear_tags!
|
|
77
|
+
super if defined?(super)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: evrone-ci-common
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Galinsky
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-09-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: evrone-common-spawn
|
|
@@ -127,6 +127,7 @@ files:
|
|
|
127
127
|
- lib/evrone/ci/common/helper/middlewares.rb
|
|
128
128
|
- lib/evrone/ci/common/helper/shell.rb
|
|
129
129
|
- lib/evrone/ci/common/perform_message_wrapper.rb
|
|
130
|
+
- lib/evrone/ci/common/tagged_logging.rb
|
|
130
131
|
- lib/evrone/ci/common/version.rb
|
|
131
132
|
- lib/evrone/ci/csm/git.rb
|
|
132
133
|
- lib/evrone/ci/csm/git/git_ssh.rb
|