00001 /// 00002 /// \file log.cc 00003 /// General Barry interface routines 00004 /// 00005 00006 /* 00007 Copyright (C) 2008, Net Direct Inc. (http://www.netdirect.ca/) 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00017 00018 See the GNU General Public License in the COPYING file at the 00019 root directory of this project for more details. 00020 */ 00021 00022 #include "log.h" 00023 #include <pthread.h> 00024 00025 namespace Barry { 00026 00027 extern bool __data_dump_mode__; 00028 extern std::ostream *LogStream; 00029 extern pthread_mutex_t LogStreamMutex; 00030 00031 LogLock::LogLock() 00032 { 00033 while( pthread_mutex_lock(&LogStreamMutex) != 0 ) 00034 ; 00035 } 00036 00037 LogLock::~LogLock() 00038 { 00039 pthread_mutex_unlock(&LogStreamMutex); 00040 } 00041 00042 00043 bool LogVerbose() 00044 { 00045 return __data_dump_mode__; 00046 } 00047 00048 std::ostream* GetLogStream() 00049 { 00050 return LogStream; 00051 } 00052 00053 } // namespace Barry 00054