logger.rb

Path: lib/mues/logger.rb  (CVS)
Last Update: Sat Aug 18 22:54:10 -0700 2007

This file contains the MUES::Logger class, a hierarchical logging class for the MUES framework. It provides a generalized means of logging from inside MUES classes, and then selectively outputting/formatting log messages from points within the hierarchy.

A lot of concepts in this class were stolen from Log4r, though it‘s all original code, and works a bit differently.

Synopsis

  require 'MUES/object'
  require 'MUES/logger'

  logger = MUES::Logger::global
  logfile = File::open( "global.log", "a" )
  logger.outputters += MUES::Logger::Outputter::new(logfile)
  logger.level = :debug

  class MyClass < MUES::Object

      def self::fooMethod
          MUES::Logger.debug( "In server start routine" )
          MUES::Logger.info( "Server is not yet configured." )
          MUES::Logger.notice( "Server is starting up." )
      end

      def initialize
          self.log.info( "Initializing another MyClass object." )
      end
  end

Subversion ID

$Id: logger.rb 1236 2004-08-24 02:15:21Z stillflame $

Authors

  • Michael Granger <ged@FaerieMUD.org>

Copyright

Copyright (c) 2000-2003 The FaerieMUD Consortium. All rights reserved.

This module is free software. You may use, modify, and/or redistribute this software under the terms of the Perl Artistic License. (See language.perl.com/misc/Artistic.html)

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Required files

mues/logger/outputter  

[Validate]