Documentation

Generated on Thu Aug 31 00:02:29 2006

 

Log.h

Go to the documentation of this file.
00001 
00002 //  $Id: Log.h,v 1.13 2005/08/23 19:34:02 klas Exp $
00003 //
00004 //  Usage: Logging defines, functions etc.
00005 //
00006 //  A part of babyftpd, licensed under the GNU GPL, see the file
00007 //    LICENSE for complete information.
00009 
00010 #ifndef LOG_H
00011 #define LOG_H
00012 
00013 #ifdef LOG_CPP
00014 #include "generic.h"
00015 #include "Configuration.h"
00016 #include "Utilities.h"
00017 #endif // LOG_CPP
00018 
00019 enum log_types { TYPE_XFER, TYPE_AUTH, TYPE_INFO, TYPE_DEBUG };
00020 
00021 class Log
00022 {
00023   private:
00024     vector<struct log_data> to_log;
00025     sem_t to_log_lock; // locking the vector when we push/pop it
00026     // these two are used to signal the logging thread it has data to pick up
00027     pthread_cond_t data_ready;
00028     pthread_mutex_t ready_mutex;
00029     void xferlog(struct log_data);
00030     void authlog(struct log_data);
00031     void infolog(struct log_data);
00032     void debuglog(struct log_data);
00033 
00034   public:
00035     void log_main(void);
00036     void log_this(int, enum log_types, string);
00037     Log(void);
00038     ~Log(void);
00039 };
00040 
00041 extern class Log *logging;
00042 
00043 struct log_data
00044 {
00045   int level;
00046   enum log_types type;
00047   string message;
00048 };
00049 
00050 #endif // LOG_H