project_files/frontlib/util/logging.c
author Medo <smaxein@googlemail.com>
Sun, 12 Aug 2012 22:37:57 +0200
changeset 7482 d70a5b0d1190
parent 7338 1ed603a54ebd
child 10017 de822cd3df3a
permissions -rw-r--r--
frontlib improvements: - Added README with overview documentation - Improved code documentation/comments - Added flib_gameconn_send_quit to gracefully exit a running game - Changed the type of some size variables to size_t - Fixed starting a mission/training sending the mission script like a multiplayer script - Removed reference counters from flib_scheme and flib_map - Removed INGAME state from netconn (there is no useful difference to ROOM state) - Added extras/jnacontrol.c to warn when functions signatures used by Hedgeroid change - Other small code improvements
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     1
/*
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     4
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     5
 * This program is free software; you can redistribute it and/or
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     6
 * modify it under the terms of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     8
 * of the License, or (at your option) any later version.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     9
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    13
 * GNU General Public License for more details.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    14
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    15
 * You should have received a copy of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    16
 * along with this program; if not, write to the Free Software
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    18
 */
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    19
7155
273ad375d64e Started work on the frontend networking library
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
#include "logging.h"
273ad375d64e Started work on the frontend networking library
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    22
#include <time.h>
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    23
#include <stdio.h>
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    24
#include <stdarg.h>
7162
fe76d24a25d7 Demo recording for the frontend library
Medo <smaxein@googlemail.com>
parents: 7160
diff changeset
    25
#include <stdlib.h>
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    26
7182
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    27
static int flib_loglevel = FLIB_LOGLEVEL_INFO;
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    28
static FILE *flib_logfile = NULL;
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    29
void (*flib_logCallback)(int level, const char *msg) = NULL;
7182
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    30
7155
273ad375d64e Started work on the frontend networking library
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
char* flib_format_ip(uint32_t numip) {
273ad375d64e Started work on the frontend networking library
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
	static char ip[16];
7177
bf6cf4dd847a Implemented public API for letting the engine render maps
Medo <smaxein@googlemail.com>
parents: 7162
diff changeset
    33
	snprintf(ip, 16, "%u.%u.%u.%u", (unsigned)(numip>>24), (unsigned)((numip>>16)&0xff), (unsigned)((numip>>8)&0xff), (unsigned)(numip&0xff));
7155
273ad375d64e Started work on the frontend networking library
Medo <smaxein@googlemail.com>
parents:
diff changeset
    34
	return ip;
273ad375d64e Started work on the frontend networking library
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
}
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    36
7182
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    37
static inline FILE *flib_log_getfile() {
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    38
	if(flib_logfile==NULL) {
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    39
		return stdout;
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    40
	} else {
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    41
		return flib_logfile;
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    42
	}
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    43
}
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    44
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    45
static int log_time(char *buffer) {
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    46
    time_t timer;
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    47
    struct tm* tm_info;
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    48
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    49
    time(&timer);
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    50
    tm_info = localtime(&timer);
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    51
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    52
    return strftime(buffer, 25, "%Y-%m-%d %H:%M:%S", tm_info);
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    53
}
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
    54
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    55
static char getPrefix(int level) {
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    56
	switch(level) {
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    57
	case FLIB_LOGLEVEL_ERROR: return 'E';
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    58
	case FLIB_LOGLEVEL_WARNING: return 'W';
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    59
	case FLIB_LOGLEVEL_INFO: return 'I';
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    60
	case FLIB_LOGLEVEL_DEBUG: return 'D';
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    61
	default: return '?';
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    62
	}
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    63
}
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    64
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    65
static void _flib_vflog(const char *func, int level, const char *fmt, va_list args) {
7182
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
    66
	if(level >= flib_loglevel) {
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    67
		char logbuffer[1024];
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    68
		logbuffer[0] = getPrefix(level);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    69
		logbuffer[1] = ' ';
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    70
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    71
		int pos = 2;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    72
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    73
		int len = log_time(logbuffer+pos);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    74
		if(len>=0) {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    75
			pos += len;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    76
			if(pos>sizeof(logbuffer)-1) pos = sizeof(logbuffer)-1;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    77
		} else {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    78
			return;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    79
		}
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    80
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    81
		len = snprintf(logbuffer+pos, sizeof(logbuffer)-pos, " [%-30s] ", func);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    82
		if(len>=0) {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    83
			pos += len;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    84
			if(pos>sizeof(logbuffer)-1) pos = sizeof(logbuffer)-1;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    85
		} else {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    86
			return;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    87
		}
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    88
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    89
		len = vsnprintf(logbuffer+pos, sizeof(logbuffer)-pos, fmt, args);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    90
		if(len>=0) {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    91
			pos += len;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    92
			if(pos>sizeof(logbuffer)-1) pos = sizeof(logbuffer)-1;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    93
		} else {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    94
			return;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    95
		}
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    96
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    97
		if(flib_logCallback != NULL) {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    98
			flib_logCallback(level, logbuffer);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    99
		} else {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   100
			FILE *logfile = flib_log_getfile();
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   101
			fputs(logbuffer, logfile);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   102
			fputc('\n', logfile);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   103
			fflush(logfile);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   104
		}
7182
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   105
	}
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   106
}
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   107
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   108
void _flib_flog(const char *func, int level, const char *fmt, ...) {
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   109
	va_list argp;
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   110
	va_start(argp, fmt);
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   111
	_flib_vflog(func, level, fmt, argp);
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   112
	va_end(argp);
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   113
}
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   114
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   115
bool _flib_fassert(const char *func, int level, bool cond, const char *fmt, ...) {
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   116
	if(!cond) {
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   117
		va_list argp;
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   118
		va_start(argp, fmt);
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   119
		_flib_vflog(func, level, fmt, argp);
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   120
		va_end(argp);
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   121
	}
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
   122
	return !cond;
7158
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   123
}
a0573014ff4f Further work on the frontend library, restructuring, ...
Medo <smaxein@googlemail.com>
parents: 7155
diff changeset
   124
7182
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   125
int flib_log_getLevel() {
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   126
	return flib_loglevel;
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   127
}
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   128
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   129
void flib_log_setLevel(int level) {
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   130
	flib_loglevel = level;
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   131
}
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   132
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   133
void flib_log_setFile(FILE *file) {
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   134
	flib_logfile = file;
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   135
	flib_logCallback = NULL;
7182
076aba32abd3 Small improvements to the frontend lib for better debugging
Medo <smaxein@googlemail.com>
parents: 7179
diff changeset
   136
}
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7182
diff changeset
   137
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7182
diff changeset
   138
bool flib_log_isActive(int level) {
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7182
diff changeset
   139
	return level >= flib_log_getLevel();
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7182
diff changeset
   140
}
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   141
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   142
void flib_log_setCallback(void (*logCallback)(int level, const char *msg)) {
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   143
	flib_logCallback = logCallback;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   144
	flib_logfile = NULL;
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   145
}