flare-tools 0.1.4 → 0.4.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/Flare-tools.txt +0 -0
- data/History.txt +114 -2
- data/LICENSE +21 -0
- data/Manifest.txt +65 -8
- data/README.txt +356 -0
- data/Rakefile +90 -25
- data/Tutorial.txt +370 -0
- data/bin/flare-admin +6 -0
- data/bin/flare-argv0 +6 -0
- data/bin/flare-deploy +6 -0
- data/bin/flare-keychecker +6 -0
- data/bin/flare-part +6 -0
- data/bin/flare-ping +6 -0
- data/bin/flare-stats +4 -10
- data/bin/flare-zkadmin +6 -0
- data/lib/flare/net/connection.rb +98 -0
- data/lib/flare/test/cluster.rb +140 -0
- data/lib/flare/test/daemon.rb +144 -0
- data/lib/flare/test/node.rb +62 -0
- data/lib/flare/tools.rb +18 -16
- data/lib/flare/tools/cli.rb +32 -0
- data/lib/flare/tools/cli/activate.rb +106 -0
- data/lib/flare/tools/cli/balance.rb +83 -0
- data/lib/flare/tools/cli/cli_util.rb +77 -0
- data/lib/flare/tools/cli/deploy.rb +170 -0
- data/lib/flare/tools/cli/down.rb +85 -0
- data/lib/flare/tools/cli/dump.rb +219 -0
- data/lib/flare/tools/cli/dumpkey.rb +117 -0
- data/lib/flare/tools/cli/flare_admin.rb +81 -0
- data/lib/flare/tools/cli/flare_argv0.rb +60 -0
- data/lib/flare/tools/cli/flare_keychecker.rb +106 -0
- data/lib/flare/tools/cli/flare_zkadmin.rb +226 -0
- data/lib/flare/tools/cli/index.rb +54 -0
- data/lib/flare/tools/cli/list.rb +93 -0
- data/lib/flare/tools/cli/master.rb +143 -0
- data/lib/flare/tools/cli/part.rb +100 -0
- data/lib/flare/tools/cli/ping.rb +81 -0
- data/lib/flare/tools/cli/reconstruct.rb +164 -0
- data/lib/flare/tools/cli/remove.rb +119 -0
- data/lib/flare/tools/cli/restore.rb +180 -0
- data/lib/flare/tools/cli/slave.rb +125 -0
- data/lib/flare/tools/cli/stats.rb +229 -122
- data/lib/flare/tools/cli/sub_command.rb +73 -0
- data/lib/flare/tools/cli/summary.rb +97 -0
- data/lib/flare/tools/cli/threads.rb +78 -0
- data/lib/flare/tools/cli/verify.rb +202 -0
- data/lib/flare/tools/client.rb +267 -0
- data/lib/flare/tools/cluster.rb +319 -0
- data/lib/flare/tools/common.rb +196 -0
- data/lib/flare/tools/index_server.rb +51 -0
- data/lib/flare/tools/node.rb +162 -0
- data/lib/flare/tools/stats.rb +75 -0
- data/lib/flare/tools/zk_util.rb +28 -0
- data/lib/flare/util.rb +34 -0
- data/lib/flare/util/bwlimit.rb +132 -0
- data/lib/flare/util/command_line.rb +79 -0
- data/lib/flare/util/conf.rb +71 -0
- data/lib/flare/util/constant.rb +25 -0
- data/lib/flare/util/conversion.rb +26 -0
- data/lib/flare/util/default_logger.rb +52 -0
- data/lib/flare/util/exception.rb +19 -0
- data/lib/flare/util/filesystem.rb +30 -0
- data/lib/flare/util/flared_conf.rb +33 -0
- data/lib/flare/util/flarei_conf.rb +32 -0
- data/lib/flare/util/hash_function.rb +32 -0
- data/lib/flare/util/interruption.rb +70 -0
- data/lib/flare/util/key_resolver.rb +67 -0
- data/lib/flare/util/log4r_logger.rb +79 -0
- data/lib/flare/util/logger.rb +40 -0
- data/lib/flare/util/logging.rb +84 -0
- data/lib/flare/util/result.rb +53 -0
- data/test/test/experimental/cache_test.rb +113 -0
- data/test/test/experimental/key_distribution_test.rb +38 -0
- data/test/test/experimental/keychecker_test.rb +60 -0
- data/test/test/experimental/list_test.rb +108 -0
- data/test/test/extra/replication_test.rb +184 -0
- data/test/test/integration/cli_test.rb +348 -0
- data/test/test/integration/dump_expired_test.rb +103 -0
- data/test/test/integration/dump_test.rb +128 -0
- data/test/test/integration/index_server_test.rb +35 -0
- data/test/test/integration/node_test.rb +78 -0
- data/test/test/integration/partition_test.rb +235 -0
- data/test/test/integration/proxy_test.rb +54 -0
- data/test/test/integration/stats_test.rb +79 -0
- data/test/test/system/flare_admin_test.rb +191 -0
- data/test/test/unit/bwlimit_test.rb +52 -0
- data/test/test/unit/cluster_test.rb +96 -0
- data/test/test/unit/daemon_test.rb +30 -0
- data/test/test/unit/logger_test.rb +46 -0
- data/test/test/unit/tools_test.rb +25 -0
- data/test/test/unit/util_test.rb +70 -0
- metadata +239 -84
- data/README.rdoc +0 -83
- data/bin/flare-partition-setting +0 -12
- data/lib/flare/tools/cli/partition_setting.rb +0 -86
- data/lib/flare/tools/core.rb +0 -189
- data/lib/flare/tools/logger.rb +0 -31
- data/test/test_flare-tools.rb +0 -11
- data/test/test_helper.rb +0 -3
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
#
|
7
|
+
module Flare
|
8
|
+
module Util
|
9
|
+
|
10
|
+
module Exception
|
11
|
+
class ServerError < StandardError
|
12
|
+
def message
|
13
|
+
"ServerError: "+super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
#
|
7
|
+
module Flare
|
8
|
+
module Util
|
9
|
+
|
10
|
+
# == Description
|
11
|
+
#
|
12
|
+
module FileSystem
|
13
|
+
|
14
|
+
# Delete all the contents in a directory.
|
15
|
+
def delete_all(file_or_directory)
|
16
|
+
return unless FileTest.exist?(file_or_directory)
|
17
|
+
if FileTest.directory?(file_or_directory)
|
18
|
+
Dir.foreach(file_or_directory) do |file|
|
19
|
+
next if /^\.+$/ =~ file
|
20
|
+
delete_all(file_or_directory.sub(/\/+$/,"") + "/" + file)
|
21
|
+
end
|
22
|
+
Dir.rmdir(file_or_directory) rescue ""
|
23
|
+
else
|
24
|
+
File.delete(file_or_directory)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
require 'flare/util/conf'
|
7
|
+
|
8
|
+
#
|
9
|
+
module Flare
|
10
|
+
module Util
|
11
|
+
class FlaredConf < Flare::Util::Conf
|
12
|
+
DefaultConf = {
|
13
|
+
'data-dir' => "/tmp",
|
14
|
+
'index-server-name' => "localhost",
|
15
|
+
'index-server-port' => "12120",
|
16
|
+
'log-facility' => "local1",
|
17
|
+
'max-connection' => "256",
|
18
|
+
'mutex-slot' => "32",
|
19
|
+
'proxy-concurrency' => "2",
|
20
|
+
'server-name' => "localhost",
|
21
|
+
'server-port' => "12121",
|
22
|
+
'storage-type' => "tch",
|
23
|
+
'thread-pool-size' => "16",
|
24
|
+
}
|
25
|
+
|
26
|
+
def initialize(config)
|
27
|
+
@config = DefaultConf.merge(config)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
require 'flare/util/conf'
|
7
|
+
|
8
|
+
#
|
9
|
+
module Flare
|
10
|
+
module Util
|
11
|
+
|
12
|
+
#
|
13
|
+
class FlareiConf < Flare::Util::Conf
|
14
|
+
DefaultConf = {
|
15
|
+
'data-dir' => "/tmp",
|
16
|
+
'log-facility' => "local0",
|
17
|
+
'max-connection' => 256,
|
18
|
+
'monitor-threshold' => 3,
|
19
|
+
'monitor-interval' => 1,
|
20
|
+
'server-name' => "localhost",
|
21
|
+
'server-port' => 12120,
|
22
|
+
'thread-pool-size' => 8,
|
23
|
+
}
|
24
|
+
|
25
|
+
def initialize(config)
|
26
|
+
@config = DefaultConf.merge(config)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
require 'zlib'
|
7
|
+
|
8
|
+
module Flare
|
9
|
+
module Util
|
10
|
+
module HashFunction
|
11
|
+
def get_key_hash_value key, type, word_size = 32
|
12
|
+
f = {
|
13
|
+
:simple => lambda {|k| r = 0; k.each_byte {|c| r += c }; r%word_size },
|
14
|
+
:bitshift => lambda {|k| r = 19790217; k.each_byte {|c| r = (r << 5) + (r << 2) + r + c }; r%word_size },
|
15
|
+
:crc32 => lambda {|k| Zlib.crc32(k, 0) },
|
16
|
+
}[type]
|
17
|
+
return nil if f.nil?
|
18
|
+
h = f.call(key)
|
19
|
+
key_hash_value = if word_size == 32
|
20
|
+
[h].pack("I").unpack("i")[0]
|
21
|
+
elsif word_size == 64
|
22
|
+
[h].pack("Q").unpack("q")[0]
|
23
|
+
else
|
24
|
+
h
|
25
|
+
end
|
26
|
+
key_hash_value = -key_hash_value if key_hash_value < 0
|
27
|
+
return key_hash_value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
module Flare
|
7
|
+
module Util
|
8
|
+
module Interruption
|
9
|
+
InterruptionTargets = []
|
10
|
+
|
11
|
+
def self.included(klass)
|
12
|
+
klass.class_eval {
|
13
|
+
alias_method :initialize_before_interruption, :initialize
|
14
|
+
def initialize(*args)
|
15
|
+
super
|
16
|
+
initialize_before_interruption(*args)
|
17
|
+
initialize_interruption
|
18
|
+
end
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.interrupt_all
|
23
|
+
InterruptionTargets.each do |x|
|
24
|
+
x.interrupt_
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize_interruption
|
29
|
+
InterruptionTargets.push self
|
30
|
+
@__interruptible__ = false
|
31
|
+
@__interrupted__ = false
|
32
|
+
end
|
33
|
+
|
34
|
+
def interruptible(&block)
|
35
|
+
@__interruptible__ = true
|
36
|
+
block.call
|
37
|
+
ensure
|
38
|
+
@__interruptible__ = false
|
39
|
+
end
|
40
|
+
|
41
|
+
def interruptible?
|
42
|
+
@__interruptible__
|
43
|
+
end
|
44
|
+
|
45
|
+
def interrupted?
|
46
|
+
@__interrupted__
|
47
|
+
ensure
|
48
|
+
@__interrupted__ = false
|
49
|
+
end
|
50
|
+
|
51
|
+
def interrupt_
|
52
|
+
@__interrupted__ = true
|
53
|
+
interrupt
|
54
|
+
end
|
55
|
+
|
56
|
+
def interrupt
|
57
|
+
if interruptible?
|
58
|
+
info "INTERRUPTED"
|
59
|
+
exit 1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Signal.trap(:INT) do
|
68
|
+
Flare::Util::Interruption.interrupt_all
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
module Flare
|
7
|
+
module Util
|
8
|
+
class KeyResolver
|
9
|
+
class Modular
|
10
|
+
def initialize params
|
11
|
+
@partition_size = params[:partition_size] || 1024
|
12
|
+
@virtual = params[:virtual] || 4096
|
13
|
+
@hint = params[:hint] || 1
|
14
|
+
@map = Array.new(@partition_size+1).map!{Array.new(@virtual, -1)}
|
15
|
+
@next_calculate = 0
|
16
|
+
calculate 1
|
17
|
+
end
|
18
|
+
|
19
|
+
def calculate psize
|
20
|
+
return if psize < @next_calculate
|
21
|
+
(@next_calculate..psize).each do |i|
|
22
|
+
if i == 0
|
23
|
+
(0...@virtual).each do |j|
|
24
|
+
@map[i][j] = 0
|
25
|
+
end
|
26
|
+
else
|
27
|
+
counter = Array.new(psize, 0)
|
28
|
+
(0...@virtual).each do |j|
|
29
|
+
if i <= @hint
|
30
|
+
@map[i][j] = j % i
|
31
|
+
else
|
32
|
+
k = @map[i-1][j]
|
33
|
+
counter[k] += 1
|
34
|
+
if (counter[k] % i) == (i - 1)
|
35
|
+
@map[i][j] = i - 1
|
36
|
+
else
|
37
|
+
@map[i][j] = @map[i-1][j]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
@next_calculate = psize+1
|
44
|
+
end
|
45
|
+
|
46
|
+
def resolve key_hash_value, partition_size
|
47
|
+
calculate partition_size
|
48
|
+
@map[partition_size][key_hash_value % @virtual]
|
49
|
+
end
|
50
|
+
|
51
|
+
def map partition_size, virtual
|
52
|
+
calculate partition_size
|
53
|
+
@map[partition_size][virtual]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def initialize(type = :modular, options = {})
|
58
|
+
@resolver = Modular.new options
|
59
|
+
end
|
60
|
+
|
61
|
+
def resolve key_hash_value, partition_size
|
62
|
+
@resolver.resolve key_hash_value, partition_size
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
require 'flare/util/logger'
|
7
|
+
require 'log4r'
|
8
|
+
require 'log4r/configurator'
|
9
|
+
|
10
|
+
#
|
11
|
+
module Flare
|
12
|
+
module Util
|
13
|
+
|
14
|
+
# == Description
|
15
|
+
# Log4rLogger is a custom logging class for log4r
|
16
|
+
class Log4rLogger < Logger
|
17
|
+
@@formatter = Log4r::PatternFormatter.new(
|
18
|
+
:pattern => "%d %C[%l]: %M",
|
19
|
+
:date_format => "%Y/%m/%d %H:%M:%S"
|
20
|
+
)
|
21
|
+
@@console_formatter = Log4r::PatternFormatter.new(
|
22
|
+
:pattern => "%M",
|
23
|
+
:date_format => "%Y/%m/%d %H:%M:%S"
|
24
|
+
)
|
25
|
+
def initialize(logger)
|
26
|
+
if logger.nil?
|
27
|
+
outputter = Log4r::StdoutOutputter.new(
|
28
|
+
"console",
|
29
|
+
:formatter => @@console_formatter
|
30
|
+
)
|
31
|
+
logger = Log4r::Logger.new($0)
|
32
|
+
logger.level = Log4r::INFO
|
33
|
+
logger.add(outputter)
|
34
|
+
elsif logger.instance_of?(String)
|
35
|
+
outputter = Log4r::FileOutputter.new(
|
36
|
+
"file",
|
37
|
+
:filename => logger,
|
38
|
+
:trunc => false,
|
39
|
+
:formatter => @@formatter
|
40
|
+
)
|
41
|
+
logger = Log4r::Logger.new($0)
|
42
|
+
logger.level = Log4r::INFO
|
43
|
+
logger.add(outputter)
|
44
|
+
end
|
45
|
+
@logger = logger
|
46
|
+
end
|
47
|
+
|
48
|
+
def info(msg)
|
49
|
+
@logger.info(msg)
|
50
|
+
end
|
51
|
+
|
52
|
+
def warn(msg)
|
53
|
+
@logger.warn(msg)
|
54
|
+
end
|
55
|
+
|
56
|
+
def trace(msg)
|
57
|
+
@logger.debug(msg)
|
58
|
+
end
|
59
|
+
|
60
|
+
def error(msg)
|
61
|
+
@logger.error(msg)
|
62
|
+
end
|
63
|
+
|
64
|
+
def fatal(msg)
|
65
|
+
@logger.fatal(msg)
|
66
|
+
end
|
67
|
+
|
68
|
+
def debug(msg)
|
69
|
+
@logger.debug(msg)
|
70
|
+
end
|
71
|
+
|
72
|
+
def console?
|
73
|
+
@logger.instance_of?(Log4r::StdoutOutputter) || @logger.instance_of?(Log4r::StderrOutputter)
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
#
|
7
|
+
module Flare
|
8
|
+
module Util
|
9
|
+
|
10
|
+
# == Description
|
11
|
+
# Logger is a custom logging class.
|
12
|
+
class Logger
|
13
|
+
def initialize(logger)
|
14
|
+
end
|
15
|
+
|
16
|
+
def info(msg)
|
17
|
+
end
|
18
|
+
|
19
|
+
def warn(msg)
|
20
|
+
end
|
21
|
+
|
22
|
+
def trace(msg)
|
23
|
+
end
|
24
|
+
|
25
|
+
def error(msg)
|
26
|
+
end
|
27
|
+
|
28
|
+
def fatal(msg)
|
29
|
+
end
|
30
|
+
|
31
|
+
def debug(msg)
|
32
|
+
end
|
33
|
+
|
34
|
+
def console?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# -*- coding: utf-8; -*-
|
2
|
+
# Authors:: Kiyoshi Ikehara <kiyoshi.ikehara@gree.net>
|
3
|
+
# Copyright:: Copyright (C) GREE, Inc. 2011.
|
4
|
+
# License:: MIT-style
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'flare/util/logger'
|
8
|
+
|
9
|
+
module Flare
|
10
|
+
module Util
|
11
|
+
module Logging
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
gem 'log4r'
|
18
|
+
require 'flare/util/log4r_logger'
|
19
|
+
Flare::Util::Logging::Logger = Flare::Util::Log4rLogger
|
20
|
+
rescue LoadError
|
21
|
+
require 'flare/util/default_logger'
|
22
|
+
Flare::Util::Logging::Logger = Flare::Util::DefaultLogger
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
module Flare
|
27
|
+
module Util
|
28
|
+
|
29
|
+
# == Description
|
30
|
+
# Logging is a mix-in module for logging.
|
31
|
+
module Logging
|
32
|
+
@@logger = nil
|
33
|
+
|
34
|
+
def self.set_logger(logger = nil)
|
35
|
+
@@logger = Logger.new(logger)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.logger
|
39
|
+
@@logger
|
40
|
+
end
|
41
|
+
|
42
|
+
def info(msg)
|
43
|
+
Logging.set_logger if @@logger.nil?
|
44
|
+
@@logger.info(msg)
|
45
|
+
end
|
46
|
+
|
47
|
+
def warn(msg)
|
48
|
+
Logging.set_logger if @@logger.nil?
|
49
|
+
@@logger.warn(msg)
|
50
|
+
end
|
51
|
+
|
52
|
+
def trace(msg)
|
53
|
+
Logging.set_logger if @@logger.nil?
|
54
|
+
@@logger.debug(msg)
|
55
|
+
end
|
56
|
+
|
57
|
+
def error(msg)
|
58
|
+
Logging.set_logger if @@logger.nil?
|
59
|
+
@@logger.error(msg)
|
60
|
+
end
|
61
|
+
|
62
|
+
def fatal(msg)
|
63
|
+
Logging.set_logger if @@logger.nil?
|
64
|
+
@@logger.fatal(msg)
|
65
|
+
end
|
66
|
+
|
67
|
+
def debug(msg)
|
68
|
+
Logging.set_logger if @@logger.nil?
|
69
|
+
@@logger.debug(msg)
|
70
|
+
end
|
71
|
+
|
72
|
+
# This hides Kernel's puts()
|
73
|
+
def puts(*args)
|
74
|
+
Logging.set_logger if @@logger.nil?
|
75
|
+
return Kernel.puts(*args) if @@logger.console?
|
76
|
+
for msg in args
|
77
|
+
info(msg)
|
78
|
+
end
|
79
|
+
nil
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|