00001 // -*- C++ -*- 00002 // 00003 // Package: Core 00004 // Class : fwLog 00005 // 00006 // Implementation: 00007 // [Notes on implementation] 00008 // 00009 // Original Author: Chris Jones 00010 // Created: Tue Dec 8 23:10:10 CST 2009 00011 // $Id: fwLog.cc,v 1.2 2009/12/11 20:25:45 amraktad Exp $ 00012 // 00013 00014 // system include files 00015 00016 // user include files 00017 #include "Fireworks/Core/interface/fwLog.h" 00018 00019 00020 // 00021 // constants, enums and typedefs 00022 // 00023 00024 // 00025 // static data member definitions 00026 // 00027 00028 namespace fwlog 00029 { 00030 00031 LogLevel s_presentLevel = kInfo; 00032 00033 const char* const s_levelNames[] = { "Debug","Info", "Warning", "Error" }; 00034 00035 const char* levelName(LogLevel iLevel) { 00036 return s_levelNames[iLevel]; 00037 } 00038 00039 std::ostream* s_logger = &std::cerr; 00040 00041 std::ostream& logger() { 00042 return *s_logger; 00043 } 00044 00045 void setLogger(std::ostream* iNewLogger) { 00046 if (0==iNewLogger) { 00047 s_logger=&std::cout; 00048 } else { 00049 s_logger=iNewLogger; 00050 } 00051 } 00052 00053 LogLevel presentLogLevel() { 00054 return s_presentLevel; 00055 } 00056 void setPresentLogLevel(LogLevel iLevel) { 00057 s_presentLevel=iLevel; 00058 } 00059 00060 }