Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Log.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  */
00009 #include "Log.h"
00010 
00011 #include "ExInfo.h"
00012 
00013 #include <stdlib.h>
00014 #include <stdio.h>
00015 
00016 int Log::ms_logLevel = LEVEL_INFO;
00017 //int Log::ms_logLevel = LEVEL_DEBUG;
00018 //-----------------------------------------------------------------
00019 /**
00020  * Print log info.
00021  * @param level priority level
00022  * @param file source file
00023  * @param line line number in source file
00024  * @param info detail info
00025  */
00026 void 
00027 Log::log(int level, const char *file, int line,
00028         const ExInfo &info) throw()
00029 {
00030     if (level <= ms_logLevel) {
00031         const char *levelName;
00032         switch (level) {
00033             case LEVEL_DEBUG:
00034                 levelName = "DEBUG";
00035                 break;
00036             case LEVEL_INFO:
00037                 levelName = "INFO";
00038                 break;
00039             case LEVEL_WARNING:
00040                 levelName = "WARNING";
00041                 break;
00042             case LEVEL_ERROR:
00043                 levelName = "ERROR";
00044                 break;
00045             default:
00046                 levelName = "UNKNOWN";
00047                 break;
00048         }
00049 
00050         fprintf(stderr, "%s:%d: %s %s\n", file, line, levelName, info.what());
00051     }
00052 }
00053 

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2