lib/fluent/logger.rb in fluent-logger-0.3.1 vs lib/fluent/logger.rb in fluent-logger-0.4.0
- old
+ new
@@ -15,35 +15,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
module Fluent
-
module Logger
- require 'fluent/logger/event'
- require 'fluent/logger/base'
+ autoload :ConsoleLogger , 'fluent/logger/console_logger'
+ autoload :FluentLogger , 'fluent/logger/fluent_logger'
+ autoload :LoggerBase , 'fluent/logger/logger_base'
+ autoload :TestLogger , 'fluent/logger/test_logger'
+ autoload :TextLogger , 'fluent/logger/text_logger'
+ autoload :NullLogger , 'fluent/logger/null_logger'
- class DefaultLogger < LoggerBase
- INSTANCE = self.new
-
- def self.instance
- INSTANCE
- end
-
- def self.new
- INSTANCE
- end
-
- def post(tag, map)
- Fluent::Logger.default.post(tag, map)
- end
-
- def close
- Fluent::Logger.default.close
- end
- end
-
@@default_logger = nil
def self.new(*args)
if args.first.is_a?(Class) && args.first.ancestors.include?(LoggerBase)
type = args.shift
@@ -63,30 +46,19 @@
@@default_logger.close
@@default_logger = nil
end
end
- def self.create_event(*args)
- DefaultLogger.instance.create_event(*args)
+ def self.post(tag, map, time=nil)
+ @@default_logger.post(tag, map, time)
end
- def self.post(tag, map)
- DefaultLogger.instance.post(tag, map)
- end
-
def self.default
@@default_logger ||= ConsoleLogger.new(STDOUT)
end
def self.default=(logger)
@@default_logger = logger
end
-
- autoload :FluentLogger, 'fluent/logger/fluent'
- autoload :ConsoleLogger, 'fluent/logger/console'
- autoload :SyslogLogger, 'fluent/logger/syslog'
- autoload :TestLogger, 'fluent/logger/test'
end
-
end
-