/*
 * log.h
 * Logging that supports both client and server.
 *
 * Copyright (C) Leni Mayo 2001-2002
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License, version 2, as
 *	published by the Free Software Foundation.
 *	
 *	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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef _LOG_H_
#define _LOG_H_

#include "common.h"

typedef enum
{
	eLogOpenModeAppend,
	eLogOpenModeTruncate
} LogOpenMode;

typedef enum
{
	eLogContextDaemon,  /* process has been started as a daemon                  */
	eLogContextTerminal /* process isn't a daemon, it has a controlling terminal */
} LogContext;

/*
 * enum LogLevel
 * eLogLevelMarkThreshold
 * 	This value isn't a level that can be passed to printLog,
 *	it's used as the threshold above which, regardless of the
 *	debug level selected by the user, log messages get printed regardless.
 */
typedef enum
{
	eLogLevelNone,          /* none                                       */
	eLogLevelDefault,       /* default                                    */
	eLogLevelRdf,           /* debugging of the rdf stuff                 */
	eLogLevelClient,        /* debug client interaction with daemon       */
	eLogLevelDeveloper,     /* debugging messages for daemon developers   */
	eLogLevelProfiling,     /* turn on very crude profiling messages      */
	eLogLevelInternalError, /* internal assertions and the like           */
	eLogLevelError          /* some (anticipated) failure                 */
} LogLevel;

void printLog(LogLevel level, const char *fmt, ...);
void logInitialise(const char *argv0, LogContext x, int debuglevel,
                   const char *pszLogName, LogOpenMode mode);
void logCleanup();

LogLevel logLevel();

#endif /* _LOG_H_ */
