mojo_logger 0.3.0-java → 0.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d11d721f03d6f5ec11d8633a6d37319d79be15ec
4
- data.tar.gz: 624e65eb57dd6e4e0c4bb9c4ce29e715f1fe91ef
3
+ metadata.gz: 8bb3586ae80852f7a2b0f2cc83a8a0211b15bffb
4
+ data.tar.gz: 5b5063bad024ef915377b40b893812b8c2633264
5
5
  SHA512:
6
- metadata.gz: 69371ddc10ef50313b8073926ee17f8786d678e2ca3891c115ce42985dc4874d982f7ba292d16d881b98e76b7f6fdcbb805b70e1801926e998ca6d769b3a7218
7
- data.tar.gz: f0c55445392bb65bc30e97aadc48d9b538f1f0db993c58a862cfc3813646cd3daf0d0f6b42497edf8cd8dd581a7fe3cee10e0cc465471327eaf8449f31112f78
6
+ metadata.gz: a0be81ef89a7fce9c6199be7b7ff83b659cfa37bbe7f476822430ecb7e046a8fdefbce34b09fbce1149bf665577ab317b22ff66541a07eb592a0834721cae081
7
+ data.tar.gz: a6cdab009aae703c487075a1e6e2c5251aa9379de64649ec7580c893038ca5125425608821afec2096661d6190ac72c468f109f2cb589e339b19e37c2a85b0ed
data/bench/gen.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'pry'
2
+ require 'benchmark'
3
+ require 'mojo_logger'
4
+
5
+ MojoLogger.config do |c|
6
+ c.default_log_level= :info
7
+ c.log_file = '/dev/null'
8
+ end
9
+
10
+ @mojo_args = [{}, "Category", "Test Message", { key: "This is a string", key2: "this is some other thing", 'key2' => "Third thing" }]
11
+
12
+ 5.times do
13
+
14
+ Benchmark.bmbm do |x|
15
+ x.report("debug") { 100000.times { MojoLogger.debug "Log message" } }
16
+ x.report("info") { 100000.times { MojoLogger.info "Log message" } }
17
+ end
18
+
19
+
20
+ Benchmark.bmbm do |x|
21
+ x.report("mojo_debug") { 100000.times { MojoLogger.mojo_debug(*@mojo_args) } }
22
+ x.report("mojo_info") { 100000.times { MojoLogger.mojo_info(*@mojo_args) } }
23
+ end
24
+
25
+ end
26
+
27
+
@@ -0,0 +1,80 @@
1
+ Rehearsal -----------------------------------------
2
+ debug 1.420000 0.040000 1.460000 ( 0.446000)
3
+ info 1.160000 0.050000 1.210000 ( 0.416000)
4
+ -------------------------------- total: 2.670000sec
5
+
6
+ user system total real
7
+ debug 0.280000 0.010000 0.290000 ( 0.117000)
8
+ info 0.120000 0.050000 0.170000 ( 0.166000)
9
+ Rehearsal ----------------------------------------------
10
+ mojo_debug 0.360000 0.010000 0.370000 ( 0.107000)
11
+ mojo_info 6.740000 0.070000 6.810000 ( 2.873000)
12
+ ------------------------------------- total: 7.180000sec
13
+
14
+ user system total real
15
+ mojo_debug 0.020000 0.000000 0.020000 ( 0.022000)
16
+ mojo_info 1.880000 0.030000 1.910000 ( 1.871000)
17
+ Rehearsal -----------------------------------------
18
+ debug 0.080000 0.000000 0.080000 ( 0.073000)
19
+ info 0.160000 0.030000 0.190000 ( 0.175000)
20
+ -------------------------------- total: 0.270000sec
21
+
22
+ user system total real
23
+ debug 0.080000 0.000000 0.080000 ( 0.075000)
24
+ info 0.150000 0.010000 0.160000 ( 0.171000)
25
+ Rehearsal ----------------------------------------------
26
+ mojo_debug 0.020000 0.000000 0.020000 ( 0.021000)
27
+ mojo_info 1.820000 0.040000 1.860000 ( 1.803000)
28
+ ------------------------------------- total: 1.880000sec
29
+
30
+ user system total real
31
+ mojo_debug 0.020000 0.000000 0.020000 ( 0.018000)
32
+ mojo_info 1.870000 0.020000 1.890000 ( 1.872000)
33
+ Rehearsal -----------------------------------------
34
+ debug 0.070000 0.000000 0.070000 ( 0.065000)
35
+ info 0.150000 0.010000 0.160000 ( 0.160000)
36
+ -------------------------------- total: 0.230000sec
37
+
38
+ user system total real
39
+ debug 0.080000 0.000000 0.080000 ( 0.069000)
40
+ info 0.150000 0.020000 0.170000 ( 0.164000)
41
+ Rehearsal ----------------------------------------------
42
+ mojo_debug 0.020000 0.000000 0.020000 ( 0.018000)
43
+ mojo_info 1.850000 0.020000 1.870000 ( 1.820000)
44
+ ------------------------------------- total: 1.890000sec
45
+
46
+ user system total real
47
+ mojo_debug 0.030000 0.000000 0.030000 ( 0.020000)
48
+ mojo_info 1.840000 0.030000 1.870000 ( 1.824000)
49
+ Rehearsal -----------------------------------------
50
+ debug 0.080000 0.000000 0.080000 ( 0.067000)
51
+ info 0.150000 0.010000 0.160000 ( 0.157000)
52
+ -------------------------------- total: 0.240000sec
53
+
54
+ user system total real
55
+ debug 0.060000 0.000000 0.060000 ( 0.068000)
56
+ info 0.160000 0.010000 0.170000 ( 0.157000)
57
+ Rehearsal ----------------------------------------------
58
+ mojo_debug 0.040000 0.000000 0.040000 ( 0.022000)
59
+ mojo_info 1.760000 0.020000 1.780000 ( 1.758000)
60
+ ------------------------------------- total: 1.820000sec
61
+
62
+ user system total real
63
+ mojo_debug 0.030000 0.000000 0.030000 ( 0.022000)
64
+ mojo_info 1.940000 0.010000 1.950000 ( 1.893000)
65
+ Rehearsal -----------------------------------------
66
+ debug 0.070000 0.000000 0.070000 ( 0.072000)
67
+ info 0.180000 0.010000 0.190000 ( 0.173000)
68
+ -------------------------------- total: 0.260000sec
69
+
70
+ user system total real
71
+ debug 0.070000 0.000000 0.070000 ( 0.075000)
72
+ info 0.160000 0.020000 0.180000 ( 0.174000)
73
+ Rehearsal ----------------------------------------------
74
+ mojo_debug 0.020000 0.000000 0.020000 ( 0.021000)
75
+ mojo_info 1.940000 0.030000 1.970000 ( 1.941000)
76
+ ------------------------------------- total: 1.990000sec
77
+
78
+ user system total real
79
+ mojo_debug 0.020000 0.000000 0.020000 ( 0.020000)
80
+ mojo_info 1.840000 0.020000 1.860000 ( 1.819000)
data/bench/results.txt ADDED
@@ -0,0 +1,80 @@
1
+ Rehearsal -----------------------------------------
2
+ debug 1.040000 0.000000 1.040000 ( 0.313000)
3
+ info 1.020000 0.020000 1.040000 ( 0.333000)
4
+ -------------------------------- total: 2.080000sec
5
+
6
+ user system total real
7
+ debug 0.250000 0.000000 0.250000 ( 0.101000)
8
+ info 0.390000 0.010000 0.400000 ( 0.196000)
9
+ Rehearsal ----------------------------------------------
10
+ mojo_debug 5.740000 0.060000 5.800000 ( 2.513000)
11
+ mojo_info 1.850000 0.030000 1.880000 ( 1.632000)
12
+ ------------------------------------- total: 7.680000sec
13
+
14
+ user system total real
15
+ mojo_debug 1.530000 0.000000 1.530000 ( 1.425000)
16
+ mojo_info 1.620000 0.030000 1.650000 ( 1.591000)
17
+ Rehearsal -----------------------------------------
18
+ debug 0.070000 0.000000 0.070000 ( 0.062000)
19
+ info 0.260000 0.030000 0.290000 ( 0.187000)
20
+ -------------------------------- total: 0.360000sec
21
+
22
+ user system total real
23
+ debug 0.060000 0.000000 0.060000 ( 0.060000)
24
+ info 0.130000 0.020000 0.150000 ( 0.149000)
25
+ Rehearsal ----------------------------------------------
26
+ mojo_debug 1.460000 0.000000 1.460000 ( 1.419000)
27
+ mojo_info 1.630000 0.030000 1.660000 ( 1.615000)
28
+ ------------------------------------- total: 3.120000sec
29
+
30
+ user system total real
31
+ mojo_debug 1.460000 0.010000 1.470000 ( 1.424000)
32
+ mojo_info 1.620000 0.030000 1.650000 ( 1.607000)
33
+ Rehearsal -----------------------------------------
34
+ debug 0.060000 0.000000 0.060000 ( 0.062000)
35
+ info 0.130000 0.020000 0.150000 ( 0.145000)
36
+ -------------------------------- total: 0.210000sec
37
+
38
+ user system total real
39
+ debug 0.070000 0.000000 0.070000 ( 0.062000)
40
+ info 0.140000 0.000000 0.140000 ( 0.147000)
41
+ Rehearsal ----------------------------------------------
42
+ mojo_debug 1.440000 0.010000 1.450000 ( 1.411000)
43
+ mojo_info 1.590000 0.030000 1.620000 ( 1.602000)
44
+ ------------------------------------- total: 3.070000sec
45
+
46
+ user system total real
47
+ mojo_debug 1.540000 0.000000 1.540000 ( 1.423000)
48
+ mojo_info 1.610000 0.030000 1.640000 ( 1.607000)
49
+ Rehearsal -----------------------------------------
50
+ debug 0.060000 0.000000 0.060000 ( 0.061000)
51
+ info 0.130000 0.020000 0.150000 ( 0.145000)
52
+ -------------------------------- total: 0.210000sec
53
+
54
+ user system total real
55
+ debug 0.070000 0.000000 0.070000 ( 0.061000)
56
+ info 0.120000 0.020000 0.140000 ( 0.147000)
57
+ Rehearsal ----------------------------------------------
58
+ mojo_debug 1.480000 0.000000 1.480000 ( 1.413000)
59
+ mojo_info 1.640000 0.020000 1.660000 ( 1.613000)
60
+ ------------------------------------- total: 3.140000sec
61
+
62
+ user system total real
63
+ mojo_debug 1.440000 0.000000 1.440000 ( 1.409000)
64
+ mojo_info 1.610000 0.030000 1.640000 ( 1.608000)
65
+ Rehearsal -----------------------------------------
66
+ debug 0.060000 0.000000 0.060000 ( 0.060000)
67
+ info 0.140000 0.010000 0.150000 ( 0.144000)
68
+ -------------------------------- total: 0.210000sec
69
+
70
+ user system total real
71
+ debug 0.070000 0.000000 0.070000 ( 0.062000)
72
+ info 0.130000 0.010000 0.140000 ( 0.145000)
73
+ Rehearsal ----------------------------------------------
74
+ mojo_debug 1.440000 0.010000 1.450000 ( 1.414000)
75
+ mojo_info 1.620000 0.030000 1.650000 ( 1.608000)
76
+ ------------------------------------- total: 3.100000sec
77
+
78
+ user system total real
79
+ mojo_debug 1.430000 0.010000 1.440000 ( 1.408000)
80
+ mojo_info 1.610000 0.020000 1.630000 ( 1.609000)
@@ -25,10 +25,18 @@ module MojoLogger
25
25
  MojoLogger.mojo_error(*args)
26
26
  end
27
27
 
28
+ def mojo_fatal(*args)
29
+ MojoLogger.mojo_fatal(*args)
30
+ end
31
+
28
32
  def logger
29
33
  MojoLogger.logger
30
34
  end
31
35
 
36
+ def level
37
+ MojoLogger.level
38
+ end
39
+
32
40
  class << self
33
41
 
34
42
  def logger
@@ -46,25 +54,41 @@ module MojoLogger
46
54
  end
47
55
 
48
56
  def mojo_debug(*args)
49
- logger.debug(mojo_msg(*args))
57
+ if level == :debug
58
+ logger.debug(mojo_msg(*args))
59
+ end
50
60
  end
51
61
 
52
62
  def mojo_info(*args)
53
- logger.info(mojo_msg(*args))
63
+ if level == :debug || level == :info
64
+ logger.info(mojo_msg(*args))
65
+ end
54
66
  end
55
67
 
56
68
  def mojo_warn(*args)
57
- logger.warn(mojo_msg(*args))
69
+ unless level == :error || level == :fatal
70
+ logger.warn(mojo_msg(*args))
71
+ end
58
72
  end
59
73
 
60
74
  def mojo_error(*args)
61
- logger.error(mojo_msg(*args))
75
+ unless level == :fatal
76
+ logger.error(mojo_msg(*args))
77
+ end
78
+ end
79
+
80
+ def mojo_fatal(*args)
81
+ logger.fatal(mojo_msg(*args))
62
82
  end
63
83
 
64
84
  def default_log_level
65
85
  configurator.default_log_level
66
86
  end
67
87
 
88
+ def level
89
+ @level ||= configurator.default_log_level.downcase.to_sym
90
+ end
91
+
68
92
  def config
69
93
  if block_given?
70
94
  @@config = MojoLogger::Configurator.new
@@ -72,10 +96,10 @@ module MojoLogger
72
96
  @@logger = configure_logger
73
97
  end
74
98
 
99
+ @level = configurator.default_log_level.downcase.to_sym
75
100
  configurator
76
101
  end
77
102
 
78
-
79
103
  private
80
104
 
81
105
  def configurator
@@ -1,3 +1,3 @@
1
1
  module MojoLogger
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mojo_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: java
6
6
  authors:
7
7
  - John Thomas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-01 00:00:00.000000000 Z
11
+ date: 2016-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -83,10 +83,12 @@ files:
83
83
  - LICENSE.txt
84
84
  - README.md
85
85
  - Rakefile
86
+ - bench/gen.rb
87
+ - bench/results-optimize-4-apr-2016.txt
88
+ - bench/results.txt
86
89
  - bin/console
87
90
  - bin/setup
88
91
  - conf/log4j.properties
89
- - lib/bench/gen.rb
90
92
  - lib/jars/log4j-1.2.17.jar
91
93
  - lib/mojo_logger.rb
92
94
  - lib/mojo_logger/appender.rb
data/lib/bench/gen.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'benchmark'
2
-
3
- array = (1..1000000).map { rand }
4
-
5
- Benchmark.bmbm do |x|
6
- x.report("sort!") { array.dup.sort! }
7
- x.report("sort") { array.dup.sort }
8
- end
9
-