00001 /* 00002 * Copyright (C) 2003-2009 Olivier Boudeville 00003 * 00004 * This file is part of the Ceylan library. 00005 * 00006 * The Ceylan library is free software: you can redistribute it and/or modify 00007 * it under the terms of either the GNU Lesser General Public License or 00008 * the GNU General Public License, as they are published by the Free Software 00009 * Foundation, either version 3 of these Licenses, or (at your option) 00010 * any later version. 00011 * 00012 * The Ceylan library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License and the GNU General Public License 00016 * for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License and the GNU General Public License along with the Ceylan library. 00020 * If not, see <http://www.gnu.org/licenses/>. 00021 * 00022 * Author: Olivier Boudeville (olivier.boudeville@esperide.com) 00023 * 00024 */ 00025 00026 00027 #include "CeylanLogPlugHTML.h" 00028 00029 #include "CeylanLogSource.h" 00030 #include "CeylanLogTransportListenerRaw.h" 00031 #include "CeylanLogAggregatorHTML.h" 00032 00033 00034 #include "CeylanOperators.h" 00035 #include "CeylanLogLight.h" 00036 00037 00038 00039 using std::string ; 00040 00041 00042 using namespace Ceylan::Log ; 00043 00044 00045 const string & LogPlugHTML::LogDirectorySuffix = "-logs" ; 00046 00047 00048 00049 void LogPlugHTML::StartService( const string & plugInitiator, bool smart ) 00050 { 00051 00052 CEYLAN_LOG( "Starting LogPlug HTML service: " 00053 "creating aggregator and transport." ) ; 00054 00055 // Plug should start empty: 00056 LogPlug::CheckBlank() ; 00057 00058 // Start by the end of the chain and go back to its beginning: 00059 00060 LogPlug::Aggregator = new LogAggregatorHTML( 00061 /* caller description */ plugInitiator, 00062 /* log ouput directory */ plugInitiator + LogDirectorySuffix, 00063 /* use Global Level Of Detail */ true, 00064 /* be smart */ smart ) ; 00065 00066 00067 /* 00068 * Listener remains blank, since it is integrated with the transport, 00069 * with the HTML scheme. 00070 * 00071 */ 00072 00073 LogPlug::Transport = new LogTransportListenerRaw( * LogPlug::Aggregator ) ; 00074 00075 // Creates basic standard channels: 00076 LogPlug::CreateBasicPlug() ; 00077 00078 // Last check before service is open: 00079 LogPlug::StartService( plugInitiator ) ; 00080 00081 } 00082 00083 00084 00085 void LogPlugHTML::StopService() 00086 { 00087 00088 LogPlug::StopService() ; 00089 00090 CEYLAN_LOG( "Stopping transport and listener." ) ; 00091 delete LogPlug::Transport ; 00092 LogPlug::Transport = 0 ; 00093 // listener is embedded in transport. 00094 00095 CEYLAN_LOG( "Stopping aggregator." ) ; 00096 delete LogPlug::Aggregator ; 00097 LogPlug::Aggregator = 0 ; 00098 00099 } 00100 00101 00102 00103 const string LogPlugHTML::ToString( Ceylan::VerbosityLevels level ) 00104 { 00105 00106 string result = "LogSystem status: using HTML plug" ; 00107 00108 if ( level != Ceylan::low ) 00109 result += ". " + LogPlug::ToString( level ) ; 00110 00111 return result ; 00112 00113 } 00114 00115 00116 00117 /* 00118 * 00119 * Not even defined: 00120 * 00121 00122 LogPlugHTML::LogPlugHTML() 00123 { 00124 throw LogException( 00125 "Ceylan::Log::LogPlugHTML should not be instanciated." ) ; 00126 } 00127 00128 00129 00130 LogPlugHTML::~LogPlugHTML() throw() 00131 { 00132 00133 } 00134 00135 */ 00136