00001 #ifndef COMBO_LOGGER_CLASS 00002 #define COMBO_LOGGER_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : combo_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 00018 #include "file_logger.h" 00019 00020 namespace loggers { 00021 00023 00026 class combo_logger : public virtual file_logger, public virtual console_logger 00027 { 00028 public: 00029 combo_logger(const basis::astring &filename, 00030 int limit = DEFAULT_LOG_FILE_SIZE, 00031 stream_choices log_target = TO_STDOUT); 00032 00033 virtual ~combo_logger() {} 00034 00035 DEFINE_CLASS_NAME("combo_logger"); 00036 00037 virtual basis::outcome log(const basis::base_string &info, int filter = basis::ALWAYS_PRINT); 00038 00039 // overrides that enforce properties for both loggers. 00040 virtual void add_filter(int new_filter); 00041 virtual void remove_filter(int old_filter); 00042 virtual void clear_filters(); 00043 virtual void eol(textual::parser_bits::line_ending to_set); 00044 }; 00045 00047 00049 #define SETUP_COMBO_LOGGER { \ 00050 basis::base_logger *old_log = program_wide_logger::set \ 00051 (new loggers::combo_logger \ 00052 (loggers::file_logger::log_file_for_app_name())); \ 00053 WHACK(old_log); \ 00054 } 00055 00056 } //namespace. 00057 00058 #endif 00059
1.6.3