/* $Revision: 22 $ $Date: 6/11/04 21:49 $ Copyright © 2000-2006, FSL Technologies Limited. Contact "http://fost3.fsltech.com". */ #include "stdafx.h" #include #include "FOST.yaml.hpp" using namespace std; using namespace FSLib; namespace { Revision c_revision( L"$Archive: /FOST.3/F3Util/log.cpp $", __DATE__, L"$Revision: 22 $", L"$Date: 6/11/04 21:49 $" ); const Setting c_rev( L"$Archive: /FOST.3/F3Util/log.cpp $", L"Log", L"Revision", L"1", true ); const Setting c_args( L"$Archive: /FOST.3/F3Util/log.cpp $", L"Log", L"Arguments", L"1", true ); const Setting c_startEnd( L"$Archive: /FOST.3/F3Util/log.cpp $", L"Log", L"Timing", L"1", true ); } /* Log */ Log::Log( const FSLib::wstring &n ) : m_stream( FSLib::narrow( n ).c_str() ) { Mutex::Lock lock( m_mutex ); if ( Setting::value( L"Log", L"Timing" ) == L"1" ) { YAML::Record rec; rec.add( L"Start", TimeStamp::now() ); #ifdef _DEBUG rec.add( L"Mode", L"Debug" ); #else rec.add( L"Mode", L"Release" ); #endif m_stream << rec << endl; } if ( Setting::value( L"Log", L"Revision" ) == L"1" ) { Revision::printAllOn( m_stream ); } } Log::~Log() { try { if ( Setting::value( L"Log", L"Timing" ) == L"1" ) { YAML::Record rec; rec.add( L"End", TimeStamp::now() ); m_stream << rec << endl; } } catch ( exception & ) { absorbException(); } } wlogstream Log::stream() { return wlogstream( m_stream, m_mutex ); }