Search
lxdream.org :: lxdream/src/util.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/util.c
changeset 586:2a3ba82cf243
prev535:7338e020b09b
next674:377d987db8f2
author nkeynes
date Tue Jan 15 20:50:23 2008 +0000 (14 years ago)
permissions -rw-r--r--
last change Merged lxdream-mmu r570:596 to trunk
file annotate diff log raw
1.1 --- a/src/util.c Tue Nov 20 09:40:49 2007 +0000
1.2 +++ b/src/util.c Tue Jan 15 20:50:23 2008 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: util.c,v 1.14 2007-11-08 11:54:16 nkeynes Exp $
1.6 + * $Id$
1.7 *
1.8 * Miscellaneous utility functions.
1.9 *
1.10 @@ -31,7 +31,7 @@
1.11 #include "dream.h"
1.12 #include "display.h"
1.13 #include "gui.h"
1.14 -#include "sh4/sh4core.h"
1.15 +#include "sh4/sh4.h"
1.16
1.17 char *msg_levels[] = { "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE" };
1.18 int global_msg_level = EMIT_WARN;
1.19 @@ -278,6 +278,30 @@
1.20 return buffer;
1.21 }
1.22
1.23 +int get_log_level_from_string( const gchar *str )
1.24 +{
1.25 + switch( tolower(str[0]) ) {
1.26 + case 'd': return EMIT_DEBUG;
1.27 + case 'e': return EMIT_ERR;
1.28 + case 'f': return EMIT_FATAL;
1.29 + case 'i': return EMIT_INFO;
1.30 + case 't': return EMIT_TRACE;
1.31 + case 'w': return EMIT_WARN;
1.32 + default: return -1;
1.33 + }
1.34 +}
1.35 +
1.36 +gboolean set_global_log_level( const gchar *str )
1.37 +{
1.38 + int l = get_log_level_from_string(str);
1.39 + if( l == -1 ) {
1.40 + return FALSE;
1.41 + } else {
1.42 + global_msg_level = l;
1.43 + return TRUE;
1.44 + }
1.45 +}
1.46 +
1.47 void log_message( void *ptr, int level, const gchar *source, const char *msg, ... )
1.48 {
1.49 char buf[20];
.