]> cygwin.com Git - cygwin-apps/setup.git/blob - LogFile.h
* Makefile.am: Treat libgetopt++ as full-fledged SUBDIRS.
[cygwin-apps/setup.git] / LogFile.h
1 /*
2 * Copyright (c) 2002, Robert Collins..
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
16 #ifndef SETUP_LOGFILE_H
17 #define SETUP_LOGFILE_H
18
19 #include "LogSingleton.h"
20 #include <sstream>
21
22 // Logging class. Default logging level is PLAIN.
23 class LogFile : public LogSingleton {
24 public:
25 static LogFile *createLogFile();
26 LogFile();
27 void clearFiles(); // delete all target filenames
28 void setFile (int minlevel, const std::string& path, bool append);
29 std::string getFileName (int level) const;
30 /* Some platforms don't call destructors. So this call exists
31 * which guarantees to flush any log data...
32 * but doesn't call generic C++ destructors
33 */
34 virtual void exit (int const exit_code) __attribute__ ((noreturn));
35 virtual ~LogFile();
36 // get a specific verbosity stream.
37 virtual std::ostream &operator() (enum log_level level);
38
39 protected:
40 LogFile(std::stringbuf *aStream);
41 LogFile (LogFile const &); // no copy constructor
42 LogFile &operator = (LogFile const&); // no assignment operator
43 virtual void endEntry(); // the current in-progress entry is complete.
44 private:
45 void log_save (int babble, const std::string& filename, bool append);
46 };
47
48 #endif /* SETUP_LOGFILE_H */
This page took 0.037304 seconds and 5 git commands to generate.