#ifndef _DWC_LOG_H
#define _DWC_LOG_H

/*--------------------------------------------------------------------------
 *  Copyright (c) 2001-2004 Igor Daniloff. 
 *	All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at this directory.
 *------------------------------------------------------------------------*/
 
/* $Id: dwc_log.h,v 1.26 2008/03/28 13:13:14 akorkov Exp $ */

#if !defined(__WIN32_DW)

#include <stdarg.h>
#include "dwc_lib.h"
#include "dwc_type.h"
#include "dwc_macro.h"

#ifdef  __cplusplus
extern "C" {
#endif

typedef struct {
    int                    code;
    DWC_string_t           name;
} DWC_msg_entry_t;

typedef enum {
    FIND_EQ,        // find only equal key (what == key)
    FIND_FULL_MASK, // find all keys gives mask in bitwise AND with mask (what & key) == what
    FIND_MASK       // find all keys gives nonzero in bitwise AND with mask (what & key) != 0
} DWC_find_t;

#define END_OF_TABLE    { -1, NULL }

/* -- LOG LEVELS ------------------------------------------------------ */
#define DW_LL_QUIET                 0     /* nothing to logging */ 
#define DW_LL_ERROR                 2     /* only errors */
#define DW_LL_ALERT                 3     /* ERROR + infected */
#define DW_LL_INFO                  4     /* ALERT + normal msg */
#define DW_LL_VERBOSE               5     /* INFO + all smtp stages */
#define DW_LL_DEBUG                 9     /* VERBOSE + debug */
#define DW_LL_EXT_DEBUG             10    /* extended debug, must be temporary */

extern DWC_bool_t   LogEnabled;
extern DWC_bool_t   LogSyslog;
extern int          LogLevel;
extern int          LogFacility;
extern int          LogPriority;
extern FILE *       logoutput;


extern DWC_string_t findWhat( int what, DWC_msg_entry_t Table[], DWC_find_t how );
extern void         InternalPrint( const int level, const char* fmt, va_list args );

#ifdef  __cplusplus
}
#endif

#endif /* WIN32 */

#endif /* _DWC_LOG_H */
