/*
 * UPIWIN - Micro Pi Windowing Framework Kernel
 * Copyright (C) 2019 Amy Bowersox/Erbosoft Metaverse Design Solutions
 *    
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *    
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *-------------------------------------------------------------------------
 */
#ifndef __LOG_H_INCLUDED
#define __LOG_H_INCLUDED

/* Logging level severities */
#define LFATAL 0    /* fatal error */
#define LERROR 1    /* error */
#define LWARN  2    /* warning */
#define LINFO  3    /* information */
#define LDEBUG 4    /* debugging */

extern void Log(int level, const char *format, ...);
extern void Log_assert_failed(const char *test, const char *file, int line);

/* Current file name definitions for assert macros */
#define THIS_FILE __FILE__
#define DECLARE_THIS_FILE() static const char THIS_FILE[] = __FILE__

/* Assert macros */
#ifdef DEBUG_ASSERT
#define ASSERT(x)  ((x) ? (void)0 : Log_assert_failed(#x, THIS_FILE, __LINE__))
#define VERIFY(x)  ASSERT(x)
#else
#define ASSERT(x)  ((void)0)
#define VERIFY(x)  ((void)(x))
#endif

#endif /* __LOG_H_INCLUDED */
