| 125 | //----------------------------------------------------------------------------- |
| 126 | |
| 127 | bool ConsoleLogger::attach() |
| 128 | { |
| 129 | if( mFilename == NULL ) |
| 130 | { |
| 131 | Con::errorf( "ConsoleLogger failed to attach: no filename supplied." ); |
| 132 | return false; |
| 133 | } |
| 134 | |
| 135 | // Check to see if this is initialized before using it |
| 136 | if( !smInitialized ) |
| 137 | { |
| 138 | if( !init() ) |
| 139 | { |
| 140 | Con::errorf( "ConsoleLogger failed to initalize." ); |
| 141 | return false; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | if( mLogging ) |
| 146 | return false; |
| 147 | |
| 148 | // Open the filestream |
| 149 | mStream.open( mFilename, ( mAppend ? Torque::FS::File::WriteAppend : Torque::FS::File::Write ) ); |
| 150 | |
| 151 | // Add this to list of active loggers |
| 152 | mActiveLoggers.push_back( this ); |
| 153 | mLogging = true; |
| 154 | |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | //----------------------------------------------------------------------------- |
| 159 |
no test coverage detected