blob: 3451c8f48a97d0eba0dda6e388c78e6da693605c [file] [log] [blame]
robert.swiecki3bb518c2010-10-14 00:48:24 +00001/*
robert.swiecki@gmail.com3b630b42015-02-16 10:53:53 +00002 *
robert.swiecki@gmail.com81189852015-02-14 23:44:55 +00003 * honggfuzz - log messages
4 * -----------------------------------------
robert.swiecki@gmail.com3b630b42015-02-16 10:53:53 +00005 *
robert.swiecki@gmail.com772b33d2015-02-14 20:35:00 +00006 * Author: Robert Swiecki <swiecki@google.com>
robert.swiecki@gmail.com3b630b42015-02-16 10:53:53 +00007 *
robert.swiecki@gmail.com772b33d2015-02-14 20:35:00 +00008 * Copyright 2010-2015 by Google Inc. All Rights Reserved.
robert.swiecki@gmail.com3b630b42015-02-16 10:53:53 +00009 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License. You may obtain
robert.swiecki@gmail.com772b33d2015-02-14 20:35:00 +000012 * a copy of the License at
robert.swiecki@gmail.com3b630b42015-02-16 10:53:53 +000013 *
robert.swiecki@gmail.com772b33d2015-02-14 20:35:00 +000014 * http://www.apache.org/licenses/LICENSE-2.0
robert.swiecki@gmail.com3b630b42015-02-16 10:53:53 +000015 *
robert.swiecki@gmail.com772b33d2015-02-14 20:35:00 +000016 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
19 * implied. See the License for the specific language governing
20 * permissions and limitations under the License.
robert.swiecki@gmail.com3b630b42015-02-16 10:53:53 +000021 *
robert.swiecki@gmail.com772b33d2015-02-14 20:35:00 +000022 */
robert.swiecki3bb518c2010-10-14 00:48:24 +000023
24#ifndef _LOG_H_
25#define _LOG_H_
26
Robert Swiecki7353a8d2015-09-08 15:53:59 +020027#include <pthread.h>
28
robert.swiecki3bb518c2010-10-14 00:48:24 +000029typedef enum {
30 l_FATAL = 0, l_ERROR, l_WARN, l_INFO, l_DEBUG
31} log_level_t;
32
33extern void log_setMinLevel(log_level_t dl);
34
robert.swiecki@gmail.combb5d2642015-02-25 20:00:00 +000035extern void log_msg(log_level_t dl, bool perr, const char *file, const char *func, int line,
36 const char *fmt, ...);
robert.swiecki3bb518c2010-10-14 00:48:24 +000037
Robert Swiecki7353a8d2015-09-08 15:53:59 +020038extern void log_mutexLock(void);
39extern void log_mutexUnLock(void);
40
robert.swiecki3bb518c2010-10-14 00:48:24 +000041#define LOGMSG(ll, ...) log_msg(ll, false, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__);
42#define LOGMSG_P(ll, ...) log_msg(ll, true, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__);
43
44#endif