To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / CollidoscopeApp / src / Log.cpp @ 9:20bb004a36de
History | View | Annotate | Download (1.37 KB)
| 1 |
/*
|
|---|---|
| 2 |
|
| 3 |
Copyright (C) 2016 Queen Mary University of London
|
| 4 |
Author: Fiore Martin
|
| 5 |
|
| 6 |
This file is part of Collidoscope.
|
| 7 |
|
| 8 |
Collidoscope is free software: you can redistribute it and/or modify
|
| 9 |
it under the terms of the GNU General Public License as published by
|
| 10 |
the Free Software Foundation, either version 3 of the License, or
|
| 11 |
(at your option) any later version.
|
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful,
|
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 16 |
GNU General Public License for more details.
|
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License
|
| 19 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 20 |
*/
|
| 21 |
|
| 22 |
|
| 23 |
#include "cinder/Log.h" |
| 24 |
|
| 25 |
bool fileLoggerCreated = false; |
| 26 |
|
| 27 |
void logError( const std::string &errorMsg ) |
| 28 |
{
|
| 29 |
using namespace ci::log; |
| 30 |
|
| 31 |
if ( !fileLoggerCreated ){
|
| 32 |
makeLogger<ci::log::LoggerFile>( "./collidoscope_error.log" );
|
| 33 |
fileLoggerCreated = true;
|
| 34 |
} |
| 35 |
|
| 36 |
LogManager *log = LogManager::instance(); |
| 37 |
|
| 38 |
Metadata logMeta; |
| 39 |
logMeta.mLevel = LEVEL_ERROR; |
| 40 |
|
| 41 |
log->write( logMeta, errorMsg ); |
| 42 |
|
| 43 |
} |
| 44 |
|
| 45 |
void logInfo( const std::string &infoMsg ) |
| 46 |
{
|
| 47 |
#ifdef _DEBUG
|
| 48 |
using namespace ci::log; |
| 49 |
|
| 50 |
LogManager *log = LogManager::instance(); |
| 51 |
|
| 52 |
Metadata logMeta; |
| 53 |
logMeta.mLevel = LEVEL_INFO; |
| 54 |
|
| 55 |
log->write( logMeta, infoMsg ); |
| 56 |
#endif
|
| 57 |
} |