torquebox-core 3.0.0-java → 3.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2d63bd1863c61f8b0e2589383b342faed0da1002
4
+ data.tar.gz: d3f20a98e2111aa72193e43b91b26a6ae1d0ee5b
5
+ SHA512:
6
+ metadata.gz: 3befc54625a78d345b0df1a39475b03e1a25d935fcba77fe1278aa51c12932a9e634ac3e870b512f31efd24efe5dc68921c16f9a39750b1e966046b6eb373500
7
+ data.tar.gz: e12667d270ff94bcfafff96c6619a9c25ff23c882d532b6a6fc9c17e12d13093a0c08b9d54076a785ec25b72814a49ab088ba4bcabedeb957ee3e5e0c54e815b
Binary file
@@ -1,6 +1,6 @@
1
1
  module TorqueboxCore
2
- VERSION = '3.0.0'
3
- MAVEN_VERSION = '3.0.0'
2
+ VERSION = '3.0.1'
3
+ MAVEN_VERSION = '3.0.1'
4
4
  end
5
5
  begin
6
6
  require 'java'
@@ -22,9 +22,12 @@ module TorqueBox
22
22
  # @api private
23
23
  class FallbackLogger < ::Logger
24
24
 
25
+ attr_accessor :formatter
26
+
25
27
  def initialize name = nil
26
- super( $stderr )
28
+ super(ENV['TORQUEBOX_FALLBACK_LOGFILE'] || $stderr)
27
29
  @category = name || (TORQUEBOX_APP_NAME if defined? TORQUEBOX_APP_NAME) || "TorqueBox"
30
+ @formatter = ::Logger::Formatter.new
28
31
  end
29
32
 
30
33
  def add(severity, message, progname, &block)
@@ -35,7 +38,17 @@ module TorqueBox
35
38
  message = progname if message.nil?
36
39
  super( severity, message, @category, &block )
37
40
  end
38
- end
41
+
42
+ # Allow our logger to be used for env['rack.errors']
43
+ def puts(message)
44
+ info message.to_s
45
+ end
46
+ def write(message)
47
+ info message.strip
48
+ end
49
+ def flush
50
+ end
51
+ end
39
52
 
40
53
  begin
41
54
  org.jboss.logging::Logger
@@ -46,15 +59,30 @@ module TorqueBox
46
59
 
47
60
  class Logger
48
61
 
62
+ attr_accessor :formatter
63
+
49
64
  def initialize name = nil
50
65
  category = name || (TORQUEBOX_APP_NAME if defined? TORQUEBOX_APP_NAME) || "TorqueBox"
51
66
  @logger = org.jboss.logging::Logger.getLogger( category.to_s.gsub('::','.') )
67
+ @formatter = ::Logger::Formatter.new
52
68
  end
53
69
 
54
70
  [:warn?, :error?, :fatal?].each do |method|
55
71
  define_method(method) { true }
56
72
  end
57
73
 
74
+ def info?
75
+ @logger.info_enabled?
76
+ end
77
+
78
+ def debug?
79
+ @logger.debug_enabled?
80
+ end
81
+
82
+ def trace?
83
+ @logger.trace_enabled?
84
+ end
85
+
58
86
  # The minimum log level to actually log, with debug being the lowest
59
87
  # and fatal the highest
60
88
  attr_accessor :level
@@ -80,26 +108,25 @@ module TorqueBox
80
108
  # @param [String] message The message to log
81
109
  def method_missing(method, *args, &block)
82
110
  delegate = method
83
- is_boolean = false
84
- if method.to_s.end_with?('?')
85
- delegate = "#{method.to_s.chop}_enabled?".to_sym
86
- is_boolean = true
87
- end
88
111
  self.class.class_eval do
89
112
  define_method(method) do |*a, &b|
90
113
  params = params_for_logger(a, b)
91
- params = [""] if params.empty? && !is_boolean
114
+ params = [""] if params.empty?
92
115
  @logger.send(delegate, *params)
93
116
  end
94
117
  end
95
118
  self.send(method, *args, &block)
96
119
  end
97
120
 
98
- # Make the Logger compatible with Rack::CommonLogger
99
- #
121
+ # Allow our logger to be used for env['rack.errors']
122
+ def puts(message)
123
+ info message.to_s
124
+ end
100
125
  def write(message)
101
126
  info message.strip
102
127
  end
128
+ def flush
129
+ end
103
130
 
104
131
  private
105
132
 
data/spec/logger_spec.rb CHANGED
@@ -1,44 +1,60 @@
1
1
 
2
2
  require 'torquebox/logger'
3
+ require 'fileutils'
3
4
  require 'logger'
4
5
 
5
- describe TorqueBox::Logger do
6
-
6
+ shared_examples_for 'a torquebox logger' do
7
7
  it "should look nice for class objects" do
8
8
  require 'torquebox/service_registry'
9
- logger = TorqueBox::Logger.new( TorqueBox::ServiceRegistry )
9
+ logger = TorqueBox::Logger.new(TorqueBox::ServiceRegistry)
10
10
  logger.error("JC: log for cache store")
11
11
  end
12
12
 
13
13
  it "should support the various boolean methods" do
14
- logger = TorqueBox::Logger.new
15
-
16
- logger.trace?.should be_false
17
- logger.debug?.should be_false
18
- logger.info?.should be_false
19
- logger.warn?.should be_true
20
- logger.error?.should be_true
21
- logger.fatal?.should be_true
14
+ logger.should respond_to(:debug?)
15
+ logger.should respond_to(:info?)
16
+ logger.should respond_to(:warn?)
17
+ logger.should respond_to(:error?)
18
+ logger.should respond_to(:fatal?)
22
19
  end
23
20
 
24
21
  it "should not barf on meaningless level setting" do
25
- logger = TorqueBox::Logger.new
26
22
  logger.level = Logger::WARN
27
23
  logger.level.should == Logger::WARN
28
24
  end
29
25
 
30
- it "should deal with blocks correctly" do
31
- logger = TorqueBox::Logger.new
26
+ it "should deal with blocks correctly" do
32
27
  logger.error "JC: message zero"
33
28
  logger.error { "JC: message" }
34
29
  logger.error "JC: message too"
35
30
  end
36
31
 
37
32
  it "should handle nil parameters" do
38
- logger = TorqueBox::Logger.new
39
33
  logger.info(nil)
40
34
  end
41
35
 
36
+ it "should support the rack.errors interface" do
37
+ logger.should respond_to(:puts)
38
+ logger.should respond_to(:write)
39
+ logger.should respond_to(:flush)
40
+ end
41
+
42
+ it "should have a formatter" do
43
+ logger.should respond_to(:formatter)
44
+ logger.formatter.should_not be_nil
45
+ end
46
+ end
47
+
48
+ describe TorqueBox::Logger do
49
+
50
+ let(:logger) { TorqueBox::Logger.new }
51
+
52
+ it_should_behave_like 'a torquebox logger'
53
+
54
+ it "should support the trace boolean method" do
55
+ logger.should respond_to(:trace?)
56
+ end
57
+
42
58
  it "should support the add method" do
43
59
  fake_logger = mock('logger')
44
60
  org.jboss.logging::Logger.stub!(:getLogger).and_return(fake_logger)
@@ -64,3 +80,24 @@ describe TorqueBox::Logger do
64
80
  end
65
81
  end
66
82
 
83
+ describe TorqueBox::FallbackLogger do
84
+ before(:each) do
85
+ @log_path = File.expand_path(File.join(File.dirname(__FILE__), '..',
86
+ 'target',
87
+ 'logger_spec_output.log'))
88
+ ENV['TORQUEBOX_FALLBACK_LOGFILE'] = @log_path
89
+ end
90
+
91
+ after(:each) do
92
+ FileUtils.rm_f(@log_path)
93
+ end
94
+
95
+ let(:logger) { TorqueBox::FallbackLogger.new }
96
+
97
+ it_should_behave_like 'a torquebox logger'
98
+
99
+ it "should let users override the fallback log file" do
100
+ logger.info('testing fallback log file')
101
+ File.read(@log_path).should include('testing fallback log file')
102
+ end
103
+ end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torquebox-core
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 3.0.0
4
+ version: 3.0.1
6
5
  platform: java
7
6
  authors:
8
7
  - The TorqueBox Team
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-28 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: edn
@@ -18,13 +17,11 @@ dependencies:
18
17
  - - '='
19
18
  - !ruby/object:Gem::Version
20
19
  version: 1.0.0
21
- none: false
22
20
  requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
22
  - - '='
25
23
  - !ruby/object:Gem::Version
26
24
  version: 1.0.0
27
- none: false
28
25
  prerelease: false
29
26
  type: :runtime
30
27
  - !ruby/object:Gem::Dependency
@@ -34,13 +31,11 @@ dependencies:
34
31
  - - '='
35
32
  - !ruby/object:Gem::Version
36
33
  version: 1.4.6
37
- none: false
38
34
  requirement: !ruby/object:Gem::Requirement
39
35
  requirements:
40
36
  - - '='
41
37
  - !ruby/object:Gem::Version
42
38
  version: 1.4.6
43
- none: false
44
39
  prerelease: false
45
40
  type: :development
46
41
  - !ruby/object:Gem::Dependency
@@ -50,13 +45,11 @@ dependencies:
50
45
  - - '='
51
46
  - !ruby/object:Gem::Version
52
47
  version: 2.7.0
53
- none: false
54
48
  requirement: !ruby/object:Gem::Requirement
55
49
  requirements:
56
50
  - - '='
57
51
  - !ruby/object:Gem::Version
58
52
  version: 2.7.0
59
- none: false
60
53
  prerelease: false
61
54
  type: :development
62
55
  description: ''
@@ -70,31 +63,32 @@ files:
70
63
  - lib/torquebox-core.jar
71
64
  - lib/torquebox-core.rb
72
65
  - lib/gem_hook.rb
73
- - lib/torquebox/core.rb
74
- - lib/torquebox/injectors.rb
75
- - lib/torquebox/component_manager.rb
66
+ - lib/torquebox/msc.rb
76
67
  - lib/torquebox/scheduled_job.rb
77
68
  - lib/torquebox/logger.rb
78
69
  - lib/torquebox/service.rb
79
70
  - lib/torquebox/kernel.rb
80
- - lib/torquebox/service_registry.rb
71
+ - lib/torquebox/core.rb
72
+ - lib/torquebox/component_manager.rb
81
73
  - lib/torquebox/codecs.rb
82
- - lib/torquebox/msc.rb
83
74
  - lib/torquebox/registry.rb
84
- - lib/torquebox/codecs/marshal_base64.rb
75
+ - lib/torquebox/injectors.rb
76
+ - lib/torquebox/service_registry.rb
77
+ - lib/torquebox/codecs/json.rb
85
78
  - lib/torquebox/codecs/marshal.rb
86
- - lib/torquebox/codecs/marshal_smart.rb
79
+ - lib/torquebox/codecs/marshal_base64.rb
87
80
  - lib/torquebox/codecs/edn.rb
88
- - lib/torquebox/codecs/json.rb
89
- - spec/kernel_spec.rb
90
- - spec/logger_spec.rb
81
+ - lib/torquebox/codecs/marshal_smart.rb
91
82
  - spec/scheduled_job_spec.rb
92
83
  - spec/injectors_spec.rb
84
+ - spec/logger_spec.rb
93
85
  - spec/codecs_spec.rb
94
86
  - spec/service_registry_spec.rb
87
+ - spec/kernel_spec.rb
95
88
  homepage: http://torquebox.org/
96
89
  licenses:
97
90
  - Public Domain
91
+ metadata: {}
98
92
  post_install_message:
99
93
  rdoc_options: []
100
94
  require_paths:
@@ -104,23 +98,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
98
  - - '>='
105
99
  - !ruby/object:Gem::Version
106
100
  version: '0'
107
- none: false
108
101
  required_rubygems_version: !ruby/object:Gem::Requirement
109
102
  requirements:
110
103
  - - '>='
111
104
  - !ruby/object:Gem::Version
112
105
  version: '0'
113
- none: false
114
106
  requirements: []
115
107
  rubyforge_project:
116
- rubygems_version: 1.8.24
108
+ rubygems_version: 2.1.9
117
109
  signing_key:
118
- specification_version: 3
110
+ specification_version: 4
119
111
  summary: TorqueBox Core Gem
120
112
  test_files:
121
- - spec/kernel_spec.rb
122
- - spec/logger_spec.rb
123
113
  - spec/scheduled_job_spec.rb
124
114
  - spec/injectors_spec.rb
115
+ - spec/logger_spec.rb
125
116
  - spec/codecs_spec.rb
126
117
  - spec/service_registry_spec.rb
118
+ - spec/kernel_spec.rb