mini_logger 0.0.1
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.
- data/README.rdoc +42 -0
- data/lib/mini_logger.rb +35 -0
- data/lib/version.rb +13 -0
- data/test/unit/tc_mini_logger.rb +13 -0
- metadata +91 -0
data/README.rdoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= Mini Logger:
|
2
|
+
|
3
|
+
|
4
|
+
== Installing
|
5
|
+
|
6
|
+
The latest stable version is published in gemcutter.
|
7
|
+
|
8
|
+
gem source --add http://gemcutter.org
|
9
|
+
gem install mini_logger
|
10
|
+
|
11
|
+
== How to use
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'mini_logger'
|
15
|
+
|
16
|
+
MiniLogger.debug( "This is a debug log line to the stderr channel" )
|
17
|
+
|
18
|
+
== TODO
|
19
|
+
|
20
|
+
|
21
|
+
== License
|
22
|
+
|
23
|
+
Copyright (c) 2010-2030 Javier Juarez Martinez
|
24
|
+
|
25
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
26
|
+
a copy of this software and associated documentation files (the
|
27
|
+
"Software"), to deal in the Software without restriction, including
|
28
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
29
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
30
|
+
permit persons to whom the Software is furnished to do so, subject to
|
31
|
+
the following conditions:
|
32
|
+
|
33
|
+
The above copyright notice and this permission notice shall be
|
34
|
+
included in all copies or substantial portions of the Software.
|
35
|
+
|
36
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
37
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
38
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
39
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
40
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
41
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
42
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/mini_logger.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'logger'
|
3
|
+
require 'config_context'
|
4
|
+
|
5
|
+
|
6
|
+
module MiniLogger
|
7
|
+
class << self
|
8
|
+
|
9
|
+
LOG_CHANNEL_KEY = :log_channel
|
10
|
+
LOG_LEVEL_KEY = :log_level
|
11
|
+
DEFAULT_CONFIGURATION = { LOG_CHANNEL_KEY=>STDERR, LOG_LEVEL_KEY=>::Logger::DEBUG }
|
12
|
+
VALID_METHODS = [:debug, :info, :warn, :error, :fatal]
|
13
|
+
|
14
|
+
|
15
|
+
def method_missing( method, *arguments, &block )
|
16
|
+
|
17
|
+
self.configure unless @logger
|
18
|
+
@logger.send( method, arguments ) if VALID_METHODS.include?( method )
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def configure( options=DEFAULT_CONFIGURATION )
|
23
|
+
|
24
|
+
ConfigContext.configure do |config|
|
25
|
+
|
26
|
+
options.keys.each { |property| config[property] = options[property] }
|
27
|
+
end
|
28
|
+
|
29
|
+
@logger ||= Logger.new( ConfigContext[LOG_CHANNEL_KEY] )
|
30
|
+
@logger.level ||= ConfigContext[LOG_LEVEL_KEY]
|
31
|
+
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mini_logger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Javier Juarez
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-14 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: mocha
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: config_context
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: config_context
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
description: My config DSL
|
50
|
+
email: javier.juarez@gmail.com
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files:
|
56
|
+
- README.rdoc
|
57
|
+
files:
|
58
|
+
- lib/mini_logger.rb
|
59
|
+
- lib/version.rb
|
60
|
+
- test/unit/tc_mini_logger.rb
|
61
|
+
- README.rdoc
|
62
|
+
has_rdoc: true
|
63
|
+
homepage: http://github.com/jjuarez/mini_logger
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: "0"
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: "0"
|
83
|
+
requirements: []
|
84
|
+
|
85
|
+
rubyforge_project: http://github.com/jjuarez/mini_logger
|
86
|
+
rubygems_version: 1.5.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: A Config Context for little applications
|
90
|
+
test_files:
|
91
|
+
- test/unit/tc_mini_logger.rb
|