gom-core 0.2.1 → 0.2.2
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/Guardfile +3 -0
- data/lib/gom/core.rb +0 -1
- data/lib/gom/core/version.rb +1 -1
- data/lib/gom/logger.rb +16 -15
- metadata +2 -4
- data/lib/gom/log.rb +0 -47
data/Guardfile
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
guard 'rspec', :version => 2, :cli => '-d' do
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
6
6
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
|
7
8
|
watch('spec/spec_helper.rb') { "spec" }
|
8
9
|
watch('lib/gom/core.rb') { "spec" }
|
10
|
+
watch('*.gemspec') { "spec" }
|
11
|
+
watch('Gemfile') { "spec" }
|
9
12
|
end
|
data/lib/gom/core.rb
CHANGED
data/lib/gom/core/version.rb
CHANGED
data/lib/gom/logger.rb
CHANGED
@@ -17,25 +17,26 @@ module Gom
|
|
17
17
|
# output defaults to STDOUT for rails test and non-rails apps, to a
|
18
18
|
# logfile otherwise
|
19
19
|
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
def initialize out =
|
33
|
-
super
|
20
|
+
def default_outstream
|
21
|
+
if ! (Object.const_defined? 'Rails')
|
22
|
+
STDOUT
|
23
|
+
else
|
24
|
+
if 'test' === ::Rails.env
|
25
|
+
STDOUT
|
26
|
+
else
|
27
|
+
"#{::Rails.root.to_s}/log/gom-#{::Rails.env}.log"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize out = nil
|
33
|
+
super(out || default_outstream)
|
34
|
+
self.level = ::Logger::DEBUG
|
34
35
|
end
|
35
36
|
|
36
37
|
# this is to de-patch the rails formatting patch..
|
37
38
|
def format_message(severity, timestamp, progname, msg)
|
38
|
-
"#{timestamp.strftime '%Y-%m-%d %H:%M:%S'} #{severity
|
39
|
+
"#{timestamp.strftime '%Y-%m-%d %H:%M:%S'} #{severity.chars.first} #{msg}\n"
|
39
40
|
end
|
40
41
|
|
41
42
|
# experimental convenience function:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gom-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -139,8 +139,6 @@ files:
|
|
139
139
|
bGliL2dvbS9jb3JlL3ByaW1pdGl2ZS5yYg==
|
140
140
|
- !binary |-
|
141
141
|
bGliL2dvbS9jb3JlL3ZlcnNpb24ucmI=
|
142
|
-
- !binary |-
|
143
|
-
bGliL2dvbS9sb2cucmI=
|
144
142
|
- !binary |-
|
145
143
|
bGliL2dvbS9sb2dnZXIucmI=
|
146
144
|
- !binary |-
|
data/lib/gom/log.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
module Gom
|
2
|
-
# GOM default Logger instance
|
3
|
-
Log = Gom::Logger.new
|
4
|
-
|
5
|
-
# TODO: runtime configuration might move to config/initializers/...
|
6
|
-
Log.level = ::Logger::DEBUG
|
7
|
-
end
|
8
|
-
|
9
|
-
__END__
|
10
|
-
|
11
|
-
Log = ::Logger.new case RAILS_ENV
|
12
|
-
when "test"
|
13
|
-
STDOUT
|
14
|
-
else
|
15
|
-
"#{RAILS_ROOT}/log/gom-#{RAILS_ENV}.log"
|
16
|
-
end
|
17
|
-
|
18
|
-
class << Log
|
19
|
-
# this is to de-patch the rails formatting patch..
|
20
|
-
def format_message(severity, timestamp, progname, msg)
|
21
|
-
"#{timestamp.to_formatted_s(:db)} #{severity.first} #{msg}\n"
|
22
|
-
end
|
23
|
-
|
24
|
-
# experimental convenience function:
|
25
|
-
#
|
26
|
-
# Log.ex e
|
27
|
-
#
|
28
|
-
# does actually do:
|
29
|
-
# Log.error e
|
30
|
-
# Log.debug "#{e.backtrace.join "\n\t"}"
|
31
|
-
#
|
32
|
-
# and:
|
33
|
-
# Log.ex e, "some message here"
|
34
|
-
#
|
35
|
-
# stands for:
|
36
|
-
# Log.error "some message here"
|
37
|
-
# Log.debug "#{e.backtrace.join "\n\t"}"
|
38
|
-
#
|
39
|
-
def ex e, msg = nil, level = :error
|
40
|
-
send level, (msg || e)
|
41
|
-
debug "#{e} -- error was: #{msg}\n\t#{e.backtrace.join "\n\t"}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# TODO: runtime configuration might move to config/initializers/...
|
46
|
-
Log.level = ::Logger::DEBUG
|
47
|
-
end
|