~ubuntu-branches/ubuntu/trusty/picviz/trusty

« back to all changes in this revision

Viewing changes to src/libpicviz/debug.c

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2009-03-30 10:42:08 UTC
  • Revision ID: james.westby@ubuntu.com-20090330104208-j095obwkp574t1lm
Tags: upstream-0.5
ImportĀ upstreamĀ versionĀ 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Picviz - Parallel coordinates ploter
 
3
 * Copyright (C) 2008 Sebastien Tricaud <toady@gscore.org>
 
4
 *
 
5
 * This program is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation version 3.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 *
 
17
 * $Id: debug.c 369 2008-12-22 00:24:39Z toady $
 
18
 */
 
19
 
 
20
#include <stdio.h>
 
21
#include <stdarg.h>
 
22
#include <time.h>
 
23
#include <string.h>
 
24
 
 
25
#include <picviz.h>
 
26
 
 
27
void picviz_debug(int level, int area, const char *format, ...)
 
28
{
 
29
        char *timestr;
 
30
        va_list ap;
 
31
        time_t tm;
 
32
        FILE *fd = stderr;
 
33
 
 
34
        if (engine.debug) {
 
35
 
 
36
                if (level == PICVIZ_DEBUG_NOTICE) {
 
37
                        fd = stdout;
 
38
                }
 
39
 
 
40
                va_start(ap, format);
 
41
 
 
42
                tm = time(NULL);
 
43
                timestr = ctime(&tm);
 
44
                timestr[strlen(timestr)-1] = '\0';
 
45
                fprintf(fd, "%s <%1d.%1d> ", timestr, level, area);
 
46
                vfprintf(fd, format, ap);
 
47
                va_end(ap);
 
48
                fprintf(fd, "\n");
 
49
 
 
50
                fflush(fd);
 
51
        }
 
52
}
 
53
 
 
54
void picviz_debug_print_axisplot(PicvizAxisPlot *axisplot)
 
55
{
 
56
        fprintf(stderr, "axisplot->strval=%s\n", axisplot->strval);
 
57
        fprintf(stderr, "axisplot->y=%lld\n", axisplot->y);
 
58
        fprintf(stderr, "axisplot->axis_id=%llu\n", axisplot->axis_id);
 
59
        fprintf(stderr, "axisplot->props->color=%s\n", picviz_properties_get(axisplot->props, "color"));
 
60
}
 
61