00001 #ifndef PROGRAM_WIDE_LOGGER_IMPLEMENTATION_FILE 00002 #define PROGRAM_WIDE_LOGGER_IMPLEMENTATION_FILE 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : program_wide_logger * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 1994-$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 #ifndef OMIT_PROGRAM_WIDE_LOGGER 00019 #include "console_logger.h" 00020 #include "file_logger.h" 00021 #include "locked_logger.h" 00022 #include "null_logger.h" 00023 #endif 00024 00025 #include <basis/callstack_tracker.h> 00026 #include <basis/function.h> 00027 #include <basis/log_base.h> 00028 #include <basis/program_wide_logger.h> 00029 #include <data_struct/static_memory_gremlin.h> 00030 #include <opsystem/critical_events.h> 00031 00032 #include <stdio.h> 00033 00034 //#define DEBUG_PROGRAM_WIDE_LOGGER 00035 // uncomment for additional checks and noises. 00036 00037 locked_logger BASIS_EXTERN &real_program_wide_logger() 00038 { 00039 SAFE_STATIC_IMPLEMENTATION(locked_logger, , __LINE__); 00040 } 00041 00042 #ifndef OMIT_PROGRAM_WIDE_LOGGER 00043 // provides the more generic version of the real logger. 00044 log_base BASIS_EXTERN &program_wide_logger() 00045 { 00046 if (!real_program_wide_logger().established()) { 00047 SET_DEFAULT_NULL_LOGGER; 00048 critical_events::write_to_critical_events((utility::timestamp(true, true) 00049 + "the program-wide logger isn't set!").s()); 00050 } 00051 return real_program_wide_logger(); 00052 } 00053 00054 log_base BASIS_EXTERN *retask_program_wide_logger 00055 (log_base *new_logger) 00056 { 00057 return real_program_wide_logger().swap(new_logger); 00058 } 00059 #endif 00060 00061 #endif //PROGRAM_WIDE_LOGGER_IMPLEMENTATION_FILE 00062
1.5.1