summaryrefslogtreecommitdiff
path: root/src/multilog.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-05-03 06:49:30 +0000
committerMike Buland <eichlan@xagasoft.com>2006-05-03 06:49:30 +0000
commit96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75 (patch)
treea930fe51f01a7400fe97b46db2fcfcdc1f2712da /src/multilog.cpp
parent33fef4a17290e7872293d8cc173bec826f24001c (diff)
downloadlibbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.tar.gz
libbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.tar.bz2
libbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.tar.xz
libbu++-96b00553a0ffe6bb34af6ad15e1cfc2bed67bd75.zip
Added a simple test for the log system, and switched the multilog to the new
singleton system, which unfortunately changed it's API slightly. Now it's not a pointer from the singleton, but I did add a new macro to make most usage of it even easier.
Diffstat (limited to 'src/multilog.cpp')
-rw-r--r--src/multilog.cpp40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/multilog.cpp b/src/multilog.cpp
index 64ff967..3dfb8b6 100644
--- a/src/multilog.cpp
+++ b/src/multilog.cpp
@@ -1,20 +1,3 @@
1/***************************************************************************
2 multilog.cpp - description
3 -------------------
4 begin : Sat Sep 6 2003
5 copyright : (C) 2003 by Mike Buland
6 email : eichlan@yf-soft.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "multilog.h" 1#include "multilog.h"
19#include <stdio.h> 2#include <stdio.h>
20#include <time.h> 3#include <time.h>
@@ -23,28 +6,9 @@
23 6
24#include "multilogchannel.h" 7#include "multilogchannel.h"
25 8
26// This section is what we need to make this a singleton 9void testlog( const char *text )
27// this makes this class easy to use from anywhere, without
28// worrying about re-creating every output form and all of that crazy jazz
29MultiLog *MultiLog::singleLog = NULL;
30
31MultiLog *MultiLog::getLog()
32{
33 if( singleLog == NULL )
34 {
35 singleLog = new MultiLog;
36 atexit( cleanup );
37 }
38 return singleLog;
39}
40
41void MultiLog::cleanup()
42{ 10{
43 if( singleLog != NULL ) 11 MultiLineLog( 4, text );
44 {
45 delete singleLog;
46 singleLog = NULL;
47 }
48} 12}
49 13
50MultiLog::MultiLog() 14MultiLog::MultiLog()