From cfdcbd734b4ede4933c87cbe4c44f8aa855b910d Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Mon, 27 May 2024 17:29:46 +0800 Subject: [PATCH] add test example code in booster --- project/booster/test/test_logger.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/project/booster/test/test_logger.c b/project/booster/test/test_logger.c new file mode 100644 index 0000000..cc4db00 --- /dev/null +++ b/project/booster/test/test_logger.c @@ -0,0 +1,45 @@ +/********************************************************************************* + * Copyright: (C) 2012 Guo Wenxue <guowenxue@gmail.com> + * All rights reserved. + * + * Filename: test_logger.c + * Description: This is the linux logger system test code. + * + * Version: 1.0.0(08/08/2012~) + * Author: Guo Wenxue <guowenxue@gmail.com> + * ChangeLog: 1, Release initial version on "08/08/2012 06:51:40 PM" + * + ********************************************************************************/ + +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <libgen.h> +#include "logger.h" + +int main (int argc, char **argv) +{ + char buf[256]; + int i; + + for(i=0; i<sizeof(buf); i++) + buf[i] = i; + +#if 0 + log_open("console", LOG_LEVEL_DEBUG, 0, LOG_LOCK_DISABLE); +#else + log_open("test.log", LOG_LEVEL_DEBUG, 10, LOG_LOCK_DISABLE); +#endif + + log_error("This is a errorr message\n"); + log_warn("This is a warnning message\n"); + log_info("This is a informat message\n"); + log_debug("This is a debug message\n"); + log_trace("This is a trace message\n"); + + log_dump(LOG_LEVEL_DEBUG, "Hex dump buffer content:", buf, sizeof(buf)); + + log_close(); + return 0; +} + -- Gitblit v1.9.1