1
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
3
* PrimeBase Media Stream for MySQL
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
* Original author: Paul McCullagh (H&G2JCtL)
20
* Continued development: Barry Leslie
25
* General logging class
41
static const int Protocol = 0;
42
static const int Error = 1;
43
static const int Warning = 2;
44
static const int Trace = 3;
46
CSLog(FILE *s, int level):
53
pthread_mutex_init(&iMutex, NULL);
59
pthread_mutex_destroy(&iMutex);
63
pthread_t thd = pthread_self();
65
if (iLockCount > 0 && pthread_equal(iLockThread, thd))
68
pthread_mutex_lock(&iMutex);
78
pthread_mutex_unlock(&iMutex);
82
void getNow(char *buffer, size_t len);
83
void log(CSThread *self, const char *func, const char *file, int line, int level, const char* buffer);
84
void log(CSThread *self, int level, const char*);
85
void log(CSThread *self, int level, CSString&);
86
void log(CSThread *self, int level, CSString*);
87
void log(CSThread *self, int level, int);
88
void eol(CSThread *self, int level);
90
void logLine(CSThread *self, int level, const char *buffer);
92
void flush() {fflush(iStream);}
94
/* Write out a logging header: */
95
void header(CSThread *self, const char *func, const char *file, int line, int level);
97
/* The output stream: */
100
bool iHeaderPending; /* True if we must write a header before the next text. */
102
int iLogLevel; /* The current log level. */
104
pthread_t iLockThread;
106
pthread_mutex_t iMutex;