/*!
  @header ECLogger
  @abstract Module of Encore
 
  @availability OS X, GNUstep
  @copyright 2004, 2005, 2006 Oliver Langer

  Author: Oliver Langer

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  04.02.06 ola     initial version
  22.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__ECLogger_H)
#define __ECLogger_H

#include <Foundation/Foundation.h>
#include <Encore/ECObject.h>
#include <Encore/ECLoggingWriter.h>
#include <Encore/ECLoggingFormatter.h>

/*!
 * @class ECLogger
 * @abstract Instance configured and created by ECLoggingConfiguration and
 *   which implements the logging
 */
@interface ECLogger : ECObject {
  @private 
    id <ECLoggingFormatter> loggingFormatter;
    id <ECLoggingWriter>    loggingWriter;
    ECLoggingLevel          loggingLevel;
}

/*!
 * @method initWithLoggingLevel
 * @abstract Called from ECLoggingConfiguration 
 * @param aLoggingLevel logging level to use
 * @param aLoggingFormatter instance used to format the output
 * @result self
 */
- initWithLoggingLevel: (ECLoggingLevel) aLoggingLevel
  withLoggingFormatter: (id <ECLoggingFormatter>) aLoggingFormatter
  withLoggingWriter: (id <ECLoggingWriter>) aLoggingWriter;
- (void) dealloc;


/*!
 * @method critical
 * @abstract If enabled, this mehod writes a message of level critical
 * @param format string format to use
 * @result self
 */
- critical: (NSString *) format, ...;


/*!
 * @method debug
 * @abstract If enabled, this mehtod writes a message of level debug
 * @param format string format to use
 * @result self
 */
- debug: (NSString *) format, ...;


/*!
 * @method error
 * @abstract If enabled, this mehtod writes a message of level error
 * @param format string format to use
 * @result self
 */
- error: (NSString *) format, ...;


/*!
 * @method fatal
 * @abstract This mehod writes a message of level fatal
 * @param format string format to use
 * @result self
 */
- fatal: (NSString *) format, ...;


/*!
 * @method info
 * @abstract If enabled, this mehtod writes a message of level info
 * @param format string format to use
 * @result self
 */
- info: (NSString *) format, ...;


/*!
 * @method isDebugEnabled
 * @result YES if debug level is being used
 */
- (BOOL) isDebugEnabled;


/*!
 * @method isTraceEnabled
 * @result YES if trace level is being used (at least)
 */
- (BOOL) isTraceEnabled;


/*!
 * @method isInfoEnabled
 * @result YES if info level is being used (at least)
 */
- (BOOL) isInfoEnabled;


/*!
 * @method isWanrEnabled
 * @result YES if warning level is being used (at least)
 */
- (BOOL) isWarnEnabled;


/*!
 * @method isErrorEnabled
 * @result YES if error level is being used (at least)
 */
- (BOOL) isErrorEnabled;


/*!
 * @method isCriticalEnabled
 * @result YES if critical level is being used (at least)
 */
- (BOOL) isCriticalEnabled;


/*!
 * @method logUsingLevel
 * @abstract internal method which performs the logging
 * @param aLevel Level at which to log. Caller must ensure that this level
 *   is valid/activated
 * @param aMsg user-defined message
 * @param args parameters for user-defined message
 * @result self
 */
- logUsingLevel: (ECLoggingLevel) aLevel
  withMessage: (NSString *) aMsg
  withArguments: (va_list) args;


/*!
 * @method warn
 * @abstract If enabled, this mehtod writes a message of level warning
 * @param format string format to use
 * @result self
 */
- warn: (NSString *) format, ...;


/*!
 * @method trace
 * @abstract If enabled, this mehtod writes a message of level trace
 * @param format string format to use
 * @result self
 */
- trace: (NSString *) format, ...;

@end
#endif
