gmyth/src/gmyth_debug.c
author renatofilho
Tue Nov 28 21:05:25 2006 +0000 (2006-11-28)
branchtrunk
changeset 132 c8fd7abae511
child 213 631f2cf13501
permissions -rw-r--r--
[svn r133] implemented debug function
     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 #include "gmyth_debug.h"
    28 
    29 void
    30 gmyth_debug_real (const char *func,
    31                   const char *file,
    32                   const int line,
    33                   gboolean newline,
    34                   const char *format, ...)
    35 {
    36     va_list args;
    37     char buffer[1025];
    38     char str_time[255];
    39     time_t the_time;
    40 
    41     va_start (args, format);
    42 
    43     g_vsnprintf (buffer, 1024, format, args);
    44 
    45     va_end (args);
    46 
    47     time (&the_time);
    48     strftime (str_time, 254, "%H:%M:%S", localtime (&the_time));
    49 
    50     g_printerr (newline ? "(%s) [%p] [%s] %s:%d: %s\n" : "(%s) [%p] [%s] %s:%d: %s",
    51             str_time, g_thread_self (), func, file, line, buffer);
    52 }