Module: XasLogger::Mix

Included in:
Standalone
Defined in:
lib/xasin_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_log_levelObject

Returns the value of attribute default_log_level.



57
58
59
# File 'lib/xasin_logger.rb', line 57

def default_log_level
  @default_log_level
end

#log_levelObject



71
72
73
74
75
76
77
# File 'lib/xasin_logger.rb', line 71

def log_level
	return Logger::DEBUG if @force_debug

	return @log_level if @log_level

	@default_log_level
end

Instance Method Details

#init_x_log(tag, logger = nil) ⇒ Object



60
61
62
63
64
65
66
67
68
69
# File 'lib/xasin_logger.rb', line 60

def init_x_log(tag, logger = nil)
	@tag = tag;
	@default_log_level = ::Logger::INFO;

	if(logger.nil?)
		@log_dest = XasLogger.loggers();
	else
		@log_dest = XasLogger.init_logger_list(logger);
	end
end

#log_dest=(newDests) ⇒ Object



103
104
105
# File 'lib/xasin_logger.rb', line 103

def log_dest=(newDests)
	@log_dest = self.class.init_logger_list(newDests);
end

#x_log(level, text) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/xasin_logger.rb', line 79

def x_log(level, text)
	return if(log_level() > level)

	@log_dest.each do |logger|
		logger.add(level, "#{@tag}: #{text}");
	end
end

#x_logd(text) ⇒ Object



87
88
89
# File 'lib/xasin_logger.rb', line 87

def x_logd(text)
	x_log(Logger::DEBUG, text);
end

#x_loge(text) ⇒ Object



96
97
98
# File 'lib/xasin_logger.rb', line 96

def x_loge(text)
	x_log(Logger::ERROR, text);
end

#x_logf(text) ⇒ Object



99
100
101
# File 'lib/xasin_logger.rb', line 99

def x_logf(text)
	x_log(Logger::FATAL, text);
end

#x_logi(text) ⇒ Object



90
91
92
# File 'lib/xasin_logger.rb', line 90

def x_logi(text)
	x_log(Logger::INFO, text);
end

#x_logw(text) ⇒ Object



93
94
95
# File 'lib/xasin_logger.rb', line 93

def x_logw(text)
	x_log(Logger::WARN, text);
end