view clustalomega/clustal-omega-0.2.0/src/clustal/log.h @ 0:ea6d0e588642 default tip

Migrated tool version 0.2 from old tool shed archive to new tool shed repository
author clustalomega
date Tue, 07 Jun 2011 16:13:02 -0400
parents
children
line wrap: on
line source

/* -*- mode: c; tab-width: 4; c-basic-offset: 4;  indent-tabs-mode: nil -*- */

/*********************************************************************
 * Clustal Omega - Multiple sequence alignment
 *
 * Copyright (C) 2010 University College Dublin
 *
 * Clustal-Omega 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 file is part of Clustal-Omega.
 *
 ********************************************************************/

/*
 *  RCS $Id$
 */


#include <stdio.h>
#include <stdarg.h>

#ifndef LOG_H
#define LOG_H


#define LOG_DEBUG 0
#define LOG_VERBOSE 1
#define LOG_INFO 2
#define LOG_WARN 3
#define LOG_FORCED_DEBUG 4
#define LOG_ERROR 5
#define LOG_CRITICAL 6
#define LOG_FATAL 7

#define LOG_NUM_LEVELS 8


typedef struct {
    /* the higher the level, the more priority it has. numbers must be
     *  sequential 
     */
    
    /* array of function pointers */
    void (*prFunc[LOG_NUM_LEVELS]) (FILE *prFP, char *pcFormat, va_list rVArgList);
    FILE *prFP[LOG_NUM_LEVELS];
    char *prPrefix[LOG_NUM_LEVELS];

    /* everything above this level will be printed */
    int iLogLevelEnabled;
} log_t;



/* a standard logger */
extern log_t rLog;



void
LogDefaultSetup(log_t *log);
void
Log(log_t *prLog, int iLevel, char *pcFmt, ...);
void
LogSetFP(log_t *log, int level, FILE *fp);
void
LogSetFPForAll(log_t *log, FILE *fp);
FILE *
LogGetFP(log_t *prLog, int iLevel);
void
LogMute(log_t *log, int level);
void
LogMuteAll(log_t *log);
void
LogFuncOverwrite(log_t *prLog, int iLevel, 
                 void (*Func) (FILE *prFP, char *pcFormat, va_list rVArgList));


#endif