/*
* The X-Log Library, helpping you log what you need to know :)
* Copyright (C) 2005 Nick Cash (admin@ew.xidus.net)
*
* 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.
*/
/*
* A special thanks to Jack "jollyjeffers" Hoxley and Oli "evolutional" Wilkinson for writing
* their excellent article on logging posted at Game-Dev. It is the inspiration for this library.
* The article can be found at: http://www.gamedev.net/reference/programming/features/xmltech/
*/
#ifndef INC_LOG_H
#define INC_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
/* general defines */
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/* end general defines */
#include <stdio.h>
/* LogEvent types */
typedef enum
{
COMMENT, UNKNOWN, ERR, WARNING, EVENT, DEBUG, MESSAGE
} log_event_types;
/* function prototypes */
void log_it(char *Fname, const char *txt, ...);
void log_entry( char *source_file, char *function, int line, const int type, const char *message, ... );
int xml_fprintf( FILE *fp, const char *tag, const char *txt, short embed );
int exists_file( char *filen );
void init_log( void );
void end_log( void );
/* macro's */
/* made for compatibility */
#define glog( txt, s... ) \
log_it( "log", txt, s )
#define L( function, linetext, s... ) \
log_entry( __FILE__, (function), __LINE__, MESSAGE, (linetext), s )
#define LT( function, type, linetext, s... ) \
log_entry( __FILE__, (function), __LINE__, (type), (linetext), s )
#ifdef __cplusplus
} /* End of extern "C" { */
#endif
#endif /* INC_LOG_H */