~ubuntu-branches/ubuntu/precise/getstream/precise

« back to all changes in this revision

Viewing changes to logging.c

  • Committer: Bazaar Package Importer
  • Author(s): Herve Rousseau
  • Date: 2007-05-31 17:23:59 UTC
  • Revision ID: james.westby@ubuntu.com-20070531172359-76b6p4jdyeyvno25
Tags: upstream-20070419
ImportĀ upstreamĀ versionĀ 20070419

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <stdarg.h>
 
3
#include <stdlib.h>
 
4
#include <sys/param.h>
 
5
#include <time.h>
 
6
 
 
7
#include "getstream.h"
 
8
 
 
9
void logwrite(int level, const char *format, ...) {
 
10
        va_list         pvar;
 
11
        char            logbuffer[MAXPATHLEN];
 
12
        time_t          t;
 
13
 
 
14
        if (level > loglevel)
 
15
                return;
 
16
 
 
17
        va_start (pvar, format);
 
18
        vsnprintf(logbuffer, sizeof(logbuffer), format, pvar);
 
19
        va_end (pvar);
 
20
 
 
21
        t=time(NULL);
 
22
 
 
23
        printf("%-24.24s %s\n",
 
24
                        ctime (&t),
 
25
                        logbuffer);
 
26
}