branches/gmyth-0.1b/src/gmyth_debug.c
author rosfran
Wed Feb 14 21:28:49 2007 +0000 (2007-02-14)
branchtrunk
changeset 360 6d5596b9eb95
permissions -rw-r--r--
[svn r362] Some fixes in the GIOWatcher clean-ups, and changed the API version number.
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_debug.c
     5  * 
     6  *
     7  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
     8  * @author Renato Filho <renato.filho@indt.org.br>
     9  *
    10  *//*
    11  * 
    12  * This program is free software; you can redistribute it and/or modify
    13  * it under the terms of the GNU Lesser General Public License as published by
    14  * the Free Software Foundation; either version 2 of the License, or
    15  * (at your option) any later version.
    16  *
    17  * This program is distributed in the hope that it will be useful,
    18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    20  * GNU General Public License for more details.
    21  *
    22  * You should have received a copy of the GNU Lesser General Public License
    23  * along with this program; if not, write to the Free Software
    24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    25  */
    26  
    27 #ifdef HAVE_CONFIG_H
    28 #include "config.h"
    29 #endif
    30 
    31 #include "gmyth_debug.h"
    32 
    33 void
    34 gmyth_debug_real (const char *func,
    35                   const char *file,
    36                   const int line,
    37                   gboolean newline,
    38                   const char *format, ...)
    39 {
    40     va_list args;
    41     char buffer[1025];
    42     char str_time[255];
    43     time_t the_time;
    44 
    45     va_start (args, format);
    46 
    47     g_vsnprintf (buffer, 1024, format, args);
    48 
    49     va_end (args);
    50 
    51     time (&the_time);
    52     strftime (str_time, 254, "%H:%M:%S", localtime (&the_time));
    53 
    54     g_printerr (newline ? "(%s) [%p] [%s] %s:%d: %s\n" : "(%s) [%p] [%s] %s:%d: %s",
    55             str_time, g_thread_self (), func, file, line, buffer);
    56 }