test_tmp.c 705 Bytes
Newer Older
Hardy Simpson's avatar
Hardy Simpson committed
1
/*
Hardy Simpson's avatar
Hardy Simpson committed
2
 * This file is part of the zlog Library.
Hardy Simpson's avatar
Hardy Simpson committed
3
 *
4
 * Copyright (C) 2011 by Hardy Simpson <HardySimpson1984@gmail.com>
Hardy Simpson's avatar
Hardy Simpson committed
5
 *
6
 * Licensed under the LGPL v2.1, see the file COPYING in base directory.
Hardy Simpson's avatar
Hardy Simpson committed
7 8
 */

Hardy Simpson's avatar
Hardy Simpson committed
9
#include <stdio.h>
Hardy Simpson's avatar
Hardy Simpson committed
10
#include "zlog.h"
11
#include <unistd.h>
Hardy Simpson's avatar
Hardy Simpson committed
12 13 14 15

int main(int argc, char** argv)
{
	int rc;
16
	zlog_category_t *zc;
Hardy Simpson's avatar
Hardy Simpson committed
17

18
	rc = zlog_init("test_tmp.conf");
Hardy Simpson's avatar
Hardy Simpson committed
19 20
	if (rc) {
		printf("init failed\n");
21
		return -1;
Hardy Simpson's avatar
Hardy Simpson committed
22 23
	}

Hardy Simpson's avatar
Hardy Simpson committed
24 25
	zc = zlog_get_category("my_cat");
	if (!zc) {
26
		printf("get cat fail\n");
27
		zlog_fini();
28
		return -2;
Hardy Simpson's avatar
Hardy Simpson committed
29 30
	}

31
	zlog_debug(zc, "%s%d");
32 33 34 35 36 37 38 39
	zlog_info(zc, "hello, zlog 2");

	sleep(1);

	zlog_info(zc, "hello, zlog 3");
	zlog_debug(zc, "hello, zlog 4");

//	zlog_profile();
Hardy Simpson's avatar
Hardy Simpson committed
40

Hardy Simpson's avatar
Hardy Simpson committed
41
	zlog_fini();
Hardy Simpson's avatar
Hardy Simpson committed
42 43 44
	
	return 0;
}