File: tester.c

package info (click to toggle)
liblogging 1.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,924 kB
  • ctags: 1,631
  • sloc: sh: 11,323; ansic: 7,502; makefile: 230
file content (24 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>
#include "stdlog.h"

int main(int argc, char *argv[])
{
	char buf[40];
	stdlog_channel_t ch;
	stdlog_channel_t ch2;
	if(argc != 2) {
		fprintf(stderr, "Usage: tester channelspec\n");
		exit(1);
	}

	stdlog_init(STDLOG_SIGSAFE);
	ch = stdlog_open("tester", 0, STDLOG_LOCAL0, argv[1]);
	ch2 = stdlog_open("tester", STDLOG_USE_DFLT_OPTS, STDLOG_LOCAL0, argv[1]);
	stdlog_log(ch, STDLOG_DEBUG, "Test %10.6s, %u, %d, %c, %x, %p, %f",
		   "abc", 4712, -4712, 'T', 0x129abcf0, NULL, 12.0345);
	stdlog_log_b(ch2, STDLOG_DEBUG, buf, sizeof(buf), "Test %100.50s, %u, %d, %c, %x, %p, %f",
		   "abc", 4712, -4712, 'T', 0x129abcf0, NULL, 12.03);
	stdlog_deinit();
	return 0;
}