Search
lxdream.org :: lxdream/src/util.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/util.c
changeset 556:72dbf70344db
prev535:7338e020b09b
next561:533f6b478071
author nkeynes
date Tue Jan 01 04:49:57 2008 +0000 (12 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Add command line option to control default log level
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 01 04:49:57 2008 +0000
1.3 @@ -278,6 +278,30 @@
1.4 return buffer;
1.5 }
1.6
1.7 +int get_log_level_from_string( const gchar *str )
1.8 +{
1.9 + switch( tolower(str[0]) ) {
1.10 + case 'd': return EMIT_DEBUG;
1.11 + case 'e': return EMIT_ERR;
1.12 + case 'f': return EMIT_FATAL;
1.13 + case 'i': return EMIT_INFO;
1.14 + case 't': return EMIT_TRACE;
1.15 + case 'w': return EMIT_WARN;
1.16 + default: return -1;
1.17 + }
1.18 +}
1.19 +
1.20 +gboolean set_global_log_level( const gchar *str )
1.21 +{
1.22 + int l = get_log_level_from_string(str);
1.23 + if( l == -1 ) {
1.24 + return FALSE;
1.25 + } else {
1.26 + global_msg_level = l;
1.27 + return TRUE;
1.28 + }
1.29 +}
1.30 +
1.31 void log_message( void *ptr, int level, const gchar *source, const char *msg, ... )
1.32 {
1.33 char buf[20];
.