00001 /* 00002 * This file is part of testrunner-lite 00003 * 00004 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00005 * 00006 * Contact: Riku Halonen <riku.halonen@nokia.com> 00007 * 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * version 2.1 as published by the Free Software Foundation. 00011 * 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00020 * 02110-1301 USA 00021 * 00022 */ 00023 00024 #ifndef LOG_H 00025 #define LOG_H 00026 00027 /* ------------------------------------------------------------------------- */ 00028 /* INCLUDES */ 00029 #include <sys/time.h> 00030 #include <time.h> 00031 #include <stdio.h> 00032 #include <syslog.h> 00033 #include "testrunnerlite.h" 00034 /* ------------------------------------------------------------------------- */ 00035 /* CONSTANTS */ 00036 #define LOG_MSG_MAX_SIZE 2048 00037 00038 /* ------------------------------------------------------------------------- */ 00039 /* MACROS */ 00040 #define LOG_MSG(__level__,__format__, __args__ ...)\ 00041 do{ \ 00042 log_msg (__level__, __FILE__, __FUNCTION__, __LINE__, \ 00043 __format__, ##__args__); \ 00044 } while (0) 00045 #define LOG_TYPES_COUNT LOG_DEBUG + 1 00046 00047 /* ------------------------------------------------------------------------- */ 00048 /* DATA TYPES */ 00049 /* ------------------------------------------------------------------------- */ 00050 00051 00052 /* ------------------------------------------------------------------------- */ 00053 /* FORWARD DECLARATIONS */ 00054 /* None */ 00055 00056 /* ------------------------------------------------------------------------- */ 00057 /* STRUCTURES */ 00058 enum log_levels { 00059 LOG_LEVEL_SILENT = 0, 00060 LOG_LEVEL_INFO, 00061 LOG_LEVEL_DEBUG, 00062 LOG_LEVELS_COUNT, /* number of entries in enum */ 00063 }; 00064 00065 /* ------------------------------------------------------------------------- */ 00066 /* FUNCTION PROTOTYPES */ 00067 00068 /* ------------------------------------------------------------------------- */ 00069 void log_msg(int type, const char *file, const char *function, 00070 int lineno, char *format, ...); 00071 /* ------------------------------------------------------------------------- */ 00072 void log_init(testrunner_lite_options *opts); 00073 /* ------------------------------------------------------------------------- */ 00074 void log_close (void); 00075 /* ------------------------------------------------------------------------- */ 00076 00077 #endif /* LOG_H */ 00078 /* End of file */ 00079