cabin 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
1
+ require "cabin"
2
+ require "spoon"
3
+
4
+
5
+ logger = Cabin::Channel.get
6
+ logger.subscribe(STDOUT)
7
+ logger.level = :info
8
+
9
+ fileactions = Spoon::FileActions.new
10
+ fileactions.close(0)
11
+ cor, cow = IO.pipe # child stdout
12
+ cer, cew = IO.pipe # child stderr
13
+ fileactions.dup2(cow.fileno, 1)
14
+ fileactions.dup2(cew.fileno, 2)
15
+
16
+ spawn_attr = Spoon::SpawnAttributes.new
17
+ pid = Spoon.posix_spawn("/bin/sh", fileactions, spawn_attr, ["sh", "-c"] + ARGV)
18
+ puts pid
19
+ cow.close
20
+ cew.close
21
+
22
+ logger.pipe(cor => :info, cer => :error)
23
+ pid, status = Process.waitpid2(pid)
24
+
25
+ puts status.inspect
@@ -12,7 +12,7 @@ module Cabin::Mixins::Logger
12
12
  :debug => 4
13
13
  }
14
14
 
15
- BACKTRACE_RE = /([^:]+):([0-9]+):in `(.*)'/
15
+ BACKTRACE_RE = /([^:]+):([0-9]+)(?::in `(.*)')?/
16
16
 
17
17
  def level=(value)
18
18
  if value.respond_to?(:downcase)
@@ -106,6 +106,7 @@ module Cabin::Mixins::Logger
106
106
  # of the logging method such as the caller's file, method, and line number.
107
107
  def debugharder(callinfo, data)
108
108
  m = BACKTRACE_RE.match(callinfo)
109
+ return unless m
109
110
  path, line, method = m[1..3]
110
111
  whence = $:.detect { |p| path.start_with?(p) }
111
112
  if whence
@@ -118,7 +119,7 @@ module Cabin::Mixins::Logger
118
119
 
119
120
  data[:file] = file
120
121
  data[:line] = line
121
- data[:method] = method
122
+ data[:method] = method if data[:method]
122
123
  end # def debugharder
123
124
 
124
125
  public(:log)
metadata CHANGED
@@ -1,88 +1,106 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cabin
3
- version: !ruby/object:Gem::Version
4
- version: 0.6.0
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 1
10
+ version: 0.6.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Jordan Sissel
9
- autorequire:
14
+ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-01-12 00:00:00.000000000 Z
17
+
18
+ date: 2013-06-18 00:00:00 Z
13
19
  dependencies: []
20
+
14
21
  description: This is an experiment to try and make logging more flexible and more consumable. Plain text logs are bullshit, let's emit structured and contextual logs. Metrics, too!
15
- email:
22
+ email:
16
23
  - jls@semicomplete.com
17
- executables:
24
+ executables:
18
25
  - rubygems-cabin-test
19
26
  extensions: []
27
+
20
28
  extra_rdoc_files: []
21
- files:
22
- - lib/cabin.rb
23
- - lib/cabin/metrics.rb
24
- - lib/cabin/timer.rb
25
- - lib/cabin/namespace.rb
26
- - lib/cabin/metric.rb
27
- - lib/cabin/context.rb
28
- - lib/cabin/publisher.rb
29
- - lib/cabin/channel.rb
30
- - lib/cabin/inspectable.rb
31
- - lib/cabin/mixins/logger.rb
32
- - lib/cabin/mixins/timer.rb
33
- - lib/cabin/mixins/CAPSLOCK.rb
34
- - lib/cabin/mixins/pipe.rb
35
- - lib/cabin/mixins/colors.rb
36
- - lib/cabin/mixins/timestamp.rb
37
- - lib/cabin/mixins/dragons.rb
29
+
30
+ files:
38
31
  - lib/cabin/metrics/timer.rb
39
- - lib/cabin/metrics/histogram.rb
40
32
  - lib/cabin/metrics/meter.rb
33
+ - lib/cabin/metrics/histogram.rb
41
34
  - lib/cabin/metrics/gauge.rb
42
35
  - lib/cabin/metrics/counter.rb
43
36
  - lib/cabin/outputs/stdlib-logger.rb
37
+ - lib/cabin/outputs/em/stdlib-logger.rb
44
38
  - lib/cabin/outputs/io.rb
45
39
  - lib/cabin/outputs/zeromq.rb
46
- - lib/cabin/outputs/em/stdlib-logger.rb
47
- - examples/metrics.rb
40
+ - lib/cabin/metric.rb
41
+ - lib/cabin/context.rb
42
+ - lib/cabin/timer.rb
43
+ - lib/cabin/inspectable.rb
44
+ - lib/cabin/publisher.rb
45
+ - lib/cabin/mixins/logger.rb
46
+ - lib/cabin/mixins/timer.rb
47
+ - lib/cabin/mixins/colors.rb
48
+ - lib/cabin/mixins/dragons.rb
49
+ - lib/cabin/mixins/timestamp.rb
50
+ - lib/cabin/mixins/CAPSLOCK.rb
51
+ - lib/cabin/mixins/pipe.rb
52
+ - lib/cabin/namespace.rb
53
+ - lib/cabin/metrics.rb
54
+ - lib/cabin/channel.rb
55
+ - lib/cabin.rb
56
+ - examples/sinatra-logging.rb
48
57
  - examples/fibonacci-timing.rb
49
58
  - examples/sample.rb
59
+ - examples/pipe-spoon.rb
60
+ - examples/metrics.rb
50
61
  - examples/pipe.rb
51
- - examples/sinatra-logging.rb
52
- - test/test_metrics.rb
53
62
  - test/all.rb
54
63
  - test/minitest-patch.rb
55
- - test/test_logging.rb
64
+ - test/test_metrics.rb
56
65
  - test/test_zeromq.rb
66
+ - test/test_logging.rb
57
67
  - LICENSE
58
68
  - CHANGELIST
59
69
  - bin/rubygems-cabin-test
60
70
  homepage: https://github.com/jordansissel/ruby-cabin
61
- licenses:
71
+ licenses:
62
72
  - Apache License (2.0)
63
- post_install_message:
73
+ post_install_message:
64
74
  rdoc_options: []
65
- require_paths:
75
+
76
+ require_paths:
66
77
  - lib
67
78
  - lib
68
- required_ruby_version: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: !binary |-
73
- MA==
79
+ required_ruby_version: !ruby/object:Gem::Requirement
74
80
  none: false
75
- required_rubygems_version: !ruby/object:Gem::Requirement
76
- requirements:
81
+ requirements:
77
82
  - - ">="
78
- - !ruby/object:Gem::Version
79
- version: !binary |-
80
- MA==
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
89
  none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
96
+ version: "0"
82
97
  requirements: []
83
- rubyforge_project:
84
- rubygems_version: 1.8.24
85
- signing_key:
98
+
99
+ rubyforge_project:
100
+ rubygems_version: 1.8.25
101
+ signing_key:
86
102
  specification_version: 3
87
103
  summary: Experiments in structured and contextual logging
88
104
  test_files: []
105
+
106
+ has_rdoc: