Clustal Omega  1.1.0
src/clustal/log.h
Go to the documentation of this file.
00001 /* -*- mode: c; tab-width: 4; c-basic-offset: 4;  indent-tabs-mode: nil -*- */
00002 
00003 /*********************************************************************
00004  * Clustal Omega - Multiple sequence alignment
00005  *
00006  * Copyright (C) 2010 University College Dublin
00007  *
00008  * Clustal-Omega is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This file is part of Clustal-Omega.
00014  *
00015  ********************************************************************/
00016 
00017 /*
00018  *  RCS $Id$
00019  */
00020 
00021 
00022 #include <stdio.h>
00023 #include <stdarg.h>
00024 
00025 #ifndef LOG_H
00026 #define LOG_H
00027 
00028 
00029 #define LOG_DEBUG 0
00030 #define LOG_VERBOSE 1
00031 #define LOG_INFO 2
00032 #define LOG_WARN 3
00033 #define LOG_FORCED_DEBUG 4
00034 #define LOG_ERROR 5
00035 #define LOG_CRITICAL 6
00036 #define LOG_FATAL 7
00037 
00038 #define LOG_NUM_LEVELS 8
00039 
00040 
00041 typedef struct {
00042     /* the higher the level, the more priority it has. numbers must be
00043      *  sequential 
00044      */
00045     
00046     /* array of function pointers */
00047     void (*prFunc[LOG_NUM_LEVELS]) (FILE *prFP, char *pcFormat, va_list rVArgList);
00048     FILE *prFP[LOG_NUM_LEVELS];
00049     char *prPrefix[LOG_NUM_LEVELS];
00050 
00051     /* everything above this level will be printed */
00052     int iLogLevelEnabled;
00053 } log_t;
00054 
00055 
00056 
00057 /* a standard logger */
00058 extern log_t rLog;
00059 
00060 
00061 
00062 void
00063 LogDefaultSetup(log_t *log);
00064 void
00065 Log(log_t *prLog, int iLevel, char *pcFmt, ...);
00066 void
00067 LogSetFP(log_t *log, int level, FILE *fp);
00068 void
00069 LogSetFPForAll(log_t *log, FILE *fp);
00070 FILE *
00071 LogGetFP(log_t *prLog, int iLevel);
00072 void
00073 LogMute(log_t *log, int level);
00074 void
00075 LogMuteAll(log_t *log);
00076 void
00077 LogFuncOverwrite(log_t *prLog, int iLevel, 
00078                  void (*Func) (FILE *prFP, char *pcFormat, va_list rVArgList));
00079 
00080 
00081 #endif