teamon-merb-colorful-logger 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +15 -0
- data/Rakefile +4 -4
- data/TODO +1 -5
- data/lib/merb-colorful-logger/logger.rb +40 -0
- data/lib/merb-colorful-logger.rb +1 -39
- metadata +7 -5
- data/README +0 -13
data/README.textile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
h2. merb-colorful-logger
|
2
|
+
|
3
|
+
A plugin for the Merb framework that provides some color in merb console and new logger method
|
4
|
+
|
5
|
+
h3. usage
|
6
|
+
|
7
|
+
somewhere:
|
8
|
+
<pre><code>
|
9
|
+
Merb.logger.d some_var_may_be_request
|
10
|
+
</pre></code>
|
11
|
+
|
12
|
+
console output (colorful!):
|
13
|
+
<pre><code>
|
14
|
+
merb : worker (port 4000) ~ #<Merb::Request:0x2474580 @route_params={:action=>"index", :controller=>"default"}...
|
15
|
+
</pre></code>
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
|
|
5
5
|
require 'merb-core/tasks/merb'
|
6
6
|
|
7
7
|
GEM_NAME = "merb-colorful-logger"
|
8
|
-
GEM_VERSION = "0.1.
|
8
|
+
GEM_VERSION = "0.1.1"
|
9
9
|
AUTHOR = "Tymon <teamon> Tobolski"
|
10
10
|
EMAIL = "i@teamon.eu"
|
11
11
|
HOMEPAGE = "http://teamon.eu/"
|
@@ -17,15 +17,15 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.version = GEM_VERSION
|
18
18
|
s.platform = Gem::Platform::RUBY
|
19
19
|
s.has_rdoc = true
|
20
|
-
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
20
|
+
s.extra_rdoc_files = ["README.textile", "LICENSE", 'TODO']
|
21
21
|
s.summary = SUMMARY
|
22
22
|
s.description = s.summary
|
23
23
|
s.author = AUTHOR
|
24
24
|
s.email = EMAIL
|
25
25
|
s.homepage = HOMEPAGE
|
26
|
-
s.add_dependency('merb', '>= 1.0')
|
26
|
+
s.add_dependency('merb-core', '>= 1.0')
|
27
27
|
s.require_path = 'lib'
|
28
|
-
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
|
28
|
+
s.files = %w(LICENSE README.textile Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
|
29
29
|
|
30
30
|
end
|
31
31
|
|
data/TODO
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Merb
|
2
|
+
class Logger
|
3
|
+
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
|
4
|
+
Colors = Mash.new({
|
5
|
+
:fatal => 31,
|
6
|
+
:error => 31,
|
7
|
+
:warn => 33,
|
8
|
+
:info => 37,
|
9
|
+
:debug => 36,
|
10
|
+
:custom => 35
|
11
|
+
})
|
12
|
+
|
13
|
+
Levels.each_pair do |name, number|
|
14
|
+
class_eval <<-LEVELMETHODS, __FILE__, __LINE__
|
15
|
+
|
16
|
+
def #{name}(message = nil)
|
17
|
+
message = block_given? ? yield : message
|
18
|
+
self << "\033[0;#{Colors[name]}m%s\033[0m" % message if #{number} >= level
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
def #{name}!(message = nil)
|
23
|
+
if #{number} >= level
|
24
|
+
message = block_given? ? yield : message
|
25
|
+
self << "\033[0;#{Colors[name]}m%s\033[0m" % message
|
26
|
+
flush
|
27
|
+
end
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
LEVELMETHODS
|
32
|
+
end
|
33
|
+
|
34
|
+
def d(message = nil)
|
35
|
+
message = block_given? ? yield : message
|
36
|
+
self << "\033[0;#{Colors[:custom]}m%s\033[0m" % message.inspect
|
37
|
+
self
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/merb-colorful-logger.rb
CHANGED
@@ -5,45 +5,7 @@ if defined?(Merb::Plugins)
|
|
5
5
|
Merb::Plugins.config[:merb_colorful_logger] = {}
|
6
6
|
|
7
7
|
Merb::BootLoader.before_app_loads do
|
8
|
-
|
9
|
-
class Logger
|
10
|
-
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
|
11
|
-
Colors = Mash.new({
|
12
|
-
:fatal => 31,
|
13
|
-
:error => 31,
|
14
|
-
:warn => 33,
|
15
|
-
:info => 37,
|
16
|
-
:debug => 36,
|
17
|
-
:custom => 35
|
18
|
-
})
|
19
|
-
|
20
|
-
Levels.each_pair do |name, number|
|
21
|
-
class_eval <<-LEVELMETHODS, __FILE__, __LINE__
|
22
|
-
|
23
|
-
def #{name}(message = nil)
|
24
|
-
message = block_given? ? yield : message
|
25
|
-
self << "\033[0;#{Colors[name]}m%s\033[0m" % message if #{number} >= level
|
26
|
-
self
|
27
|
-
end
|
28
|
-
|
29
|
-
def #{name}!(message = nil)
|
30
|
-
if #{number} >= level
|
31
|
-
message = block_given? ? yield : message
|
32
|
-
self << "\033[0;#{Colors[name]}m%s\033[0m" % message
|
33
|
-
flush
|
34
|
-
end
|
35
|
-
self
|
36
|
-
end
|
37
|
-
|
38
|
-
LEVELMETHODS
|
39
|
-
end
|
40
|
-
|
41
|
-
def d(message = nil)
|
42
|
-
self << "\033[0;#{Colors[:custom]}m%s\033[0m" % message.inspect
|
43
|
-
self
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
8
|
+
require "merb-colorful-logger/logger.rb"
|
47
9
|
end
|
48
10
|
|
49
11
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teamon-merb-colorful-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tymon <teamon> Tobolski
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-17 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: merb
|
16
|
+
name: merb-core
|
17
17
|
version_requirement:
|
18
18
|
version_requirements: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
@@ -28,14 +28,16 @@ executables: []
|
|
28
28
|
extensions: []
|
29
29
|
|
30
30
|
extra_rdoc_files:
|
31
|
-
- README
|
31
|
+
- README.textile
|
32
32
|
- LICENSE
|
33
33
|
- TODO
|
34
34
|
files:
|
35
35
|
- LICENSE
|
36
|
-
- README
|
36
|
+
- README.textile
|
37
37
|
- Rakefile
|
38
38
|
- TODO
|
39
|
+
- lib/merb-colorful-logger
|
40
|
+
- lib/merb-colorful-logger/logger.rb
|
39
41
|
- lib/merb-colorful-logger.rb
|
40
42
|
- spec/merb-colorful-logger_spec.rb
|
41
43
|
- spec/spec_helper.rb
|
data/README
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
merb-colorful-logger
|
2
|
-
====================
|
3
|
-
|
4
|
-
A plugin for the Merb framework that provides some color in merb -i and new logger method
|
5
|
-
|
6
|
-
usage
|
7
|
-
=====
|
8
|
-
|
9
|
-
somewhere:
|
10
|
-
Merb.logger.d some_var_may_be_request
|
11
|
-
|
12
|
-
terminal output (colorful!):
|
13
|
-
merb : worker (port 4000) ~ #<Merb::Request:0x2474580 @route_params={:action=>"index", :controller=>"default"},
|