enhanced-logger 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/enhanced_logger.rb +2 -0
- data/lib/models/enhanced_logger.rb +56 -0
- data/lib/rails/application_controller.rb +4 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da001aa0d1d9b2c566ed40d1d8ed503166f79be8
|
4
|
+
data.tar.gz: f7212cd71ee26f5f9729a0ede017a3ea35d56094
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6fd8291702ce760be50c354a5858255c7dde57d0003fea6a2e6336bfa8c9d44995e34eb2e6ad4ff9c02ebfa5eb34e1835383d2d1c27880d6d7fcf0c5dff3e7b3
|
7
|
+
data.tar.gz: a1b6a77de7abdb9913f12e93bb68ad1786eaed23a97bff02d7a4dd869fc71d3d71b7789c118db5ac1db343e7e7b4d35104c2adafa059e7505f09bb56b874cae9
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class EnhancedLogger
|
2
|
+
attr_accessor :level
|
3
|
+
|
4
|
+
def initialize dest
|
5
|
+
$stdout.sync = true
|
6
|
+
end
|
7
|
+
|
8
|
+
def set_env env
|
9
|
+
@request_id = env[ 'HTTP_X_REQUEST_ID' ]
|
10
|
+
@remote_request_id = env[ 'HTTP_X_REMOTE_REQUEST_ID' ]
|
11
|
+
end
|
12
|
+
|
13
|
+
def clear_env
|
14
|
+
end
|
15
|
+
|
16
|
+
def info msg = nil
|
17
|
+
return unless msg
|
18
|
+
|
19
|
+
puts formatted( msg )
|
20
|
+
end
|
21
|
+
|
22
|
+
def info?
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def debug?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
def debug msg
|
31
|
+
puts formatted( msg )
|
32
|
+
end
|
33
|
+
|
34
|
+
def error msg
|
35
|
+
puts formatted( msg )
|
36
|
+
end
|
37
|
+
|
38
|
+
def fatal msg
|
39
|
+
puts formatted( msg )
|
40
|
+
end
|
41
|
+
|
42
|
+
def formatter
|
43
|
+
''
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def formatted msg
|
50
|
+
previous = caller[ 1 ].split( '/' ).last
|
51
|
+
parts = previous.split( /[\.|:]/ )
|
52
|
+
method = previous.split( /`/ ).last.gsub( "'", "" )
|
53
|
+
|
54
|
+
"#{ @remote_request_id } #{ @request_id } #{ parts[ 0 ]} #{ method } #{ parts[ 2 ]}: #{ msg }"
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: enhanced-logger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- George Ulmer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Logs extra info.
|
14
|
+
email: george@boost-media.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/enhanced_logger.rb
|
20
|
+
- lib/models/enhanced_logger.rb
|
21
|
+
- lib/rails/application_controller.rb
|
22
|
+
homepage: http://rubygems.org/gems/enhanced_logger
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.5.1
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Enhanced Logger
|
46
|
+
test_files: []
|