console_logger.h

Go to the documentation of this file.
00001 #ifndef CONSOLE_LOGGER_CLASS
00002 #define CONSOLE_LOGGER_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : console_logger                                                    *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2000-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00019 
00024 #include "dll_loggers.h"
00025 
00026 #include <basis/function.h>
00027 #include <basis/log_base.h>
00028 
00029 class LOGGERS_CLASS_STYLE console_logger : public log_base
00030 {
00031 public:
00032   console_logger(bool standard_error = false);
00034   virtual ~console_logger();
00035 
00036   IMPLEMENT_CLASS_NAME("console_logger");
00037 
00038   bool standard_output() const { return !_to_stderr; }
00040   bool standard_error() const { return _to_stderr; }
00042 
00043   void set_output(bool standard_error) { _to_stderr = standard_error; }
00045 
00046   virtual outcome log(const istring &info, int filter = ALWAYS_PRINT);
00048 
00055 private:
00056   bool _to_stderr;  
00057 };
00058 
00060 
00061 #ifndef OMIT_PROGRAM_WIDE_LOGGER
00063 
00065   log_base LOGGERS_FUNCTION_STYLE *set_PW_logger_for_console
00066       (bool standard_error = false);
00067 
00069   #define SET_DEFAULT_CONSOLE_LOGGER { \
00070     log_base *old_log = set_PW_logger_for_console(); \
00071     WHACK(old_log); \
00072   }
00073 
00075   #define SET_DEFAULT_ERROR_LOGGER { \
00076     log_base *old_log = set_PW_logger_for_console(true); \
00077     WHACK(old_log); \
00078   }
00079 #else
00080   #define SET_DEFAULT_CONSOLE_LOGGER
00081   #define SET_DEFAULT_ERROR_LOGGER
00082 #endif
00083 
00084 #endif
00085 

Generated on Fri Nov 28 04:29:15 2008 for HOOPLE Libraries by  doxygen 1.5.1