branches/gmyth-0.1b/src/gmyth_debug.c
branchtrunk
changeset 320 22a17127789e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/branches/gmyth-0.1b/src/gmyth_debug.c	Thu Feb 01 18:42:01 2007 +0000
     1.3 @@ -0,0 +1,56 @@
     1.4 +/**
     1.5 + * GMyth Library
     1.6 + *
     1.7 + * @file gmyth/gmyth_debug.c
     1.8 + * 
     1.9 + *
    1.10 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    1.11 + * @author Renato Filho <renato.filho@indt.org.br>
    1.12 + *
    1.13 + *//*
    1.14 + * 
    1.15 + * This program is free software; you can redistribute it and/or modify
    1.16 + * it under the terms of the GNU Lesser General Public License as published by
    1.17 + * the Free Software Foundation; either version 2 of the License, or
    1.18 + * (at your option) any later version.
    1.19 + *
    1.20 + * This program is distributed in the hope that it will be useful,
    1.21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.23 + * GNU General Public License for more details.
    1.24 + *
    1.25 + * You should have received a copy of the GNU Lesser General Public License
    1.26 + * along with this program; if not, write to the Free Software
    1.27 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.28 + */
    1.29 + 
    1.30 +#ifdef HAVE_CONFIG_H
    1.31 +#include "config.h"
    1.32 +#endif
    1.33 +
    1.34 +#include "gmyth_debug.h"
    1.35 +
    1.36 +void
    1.37 +gmyth_debug_real (const char *func,
    1.38 +                  const char *file,
    1.39 +                  const int line,
    1.40 +                  gboolean newline,
    1.41 +                  const char *format, ...)
    1.42 +{
    1.43 +    va_list args;
    1.44 +    char buffer[1025];
    1.45 +    char str_time[255];
    1.46 +    time_t the_time;
    1.47 +
    1.48 +    va_start (args, format);
    1.49 +
    1.50 +    g_vsnprintf (buffer, 1024, format, args);
    1.51 +
    1.52 +    va_end (args);
    1.53 +
    1.54 +    time (&the_time);
    1.55 +    strftime (str_time, 254, "%H:%M:%S", localtime (&the_time));
    1.56 +
    1.57 +    g_printerr (newline ? "(%s) [%p] [%s] %s:%d: %s\n" : "(%s) [%p] [%s] %s:%d: %s",
    1.58 +            str_time, g_thread_self (), func, file, line, buffer);
    1.59 +}