]> cygwin.com Git - cygwin-apps/setup.git/blame - LogFile.h
Added dpiAwareness element to manifest
[cygwin-apps/setup.git] / LogFile.h
CommitLineData
9f4a0c62
RC
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
12e726c4
MB
16#ifndef SETUP_LOGFILE_H
17#define SETUP_LOGFILE_H
18
9f4a0c62 19#include "LogSingleton.h"
c83c52d8 20#include <sstream>
9f4a0c62
RC
21
22// Logging class. Default logging level is PLAIN.
23class LogFile : public LogSingleton {
24public:
15004270 25 static LogFile *createLogFile();
9f4a0c62
RC
26 LogFile();
27 void clearFiles(); // delete all target filenames
08678720
MB
28 void setFile (int minlevel, const std::string& path, bool append);
29 std::string getFileName (int level) const;
5fa64c3c
CV
30
31 static void setExitMsg (int msg) { exit_msg = msg; }
32 static int getExitMsg () { return exit_msg; }
33
9f4a0c62
RC
34 /* Some platforms don't call destructors. So this call exists
35 * which guarantees to flush any log data...
36 * but doesn't call generic C++ destructors
37 */
5fa64c3c
CV
38 virtual void exit (int exit_code, bool show_end_install_msg = true)
39 __attribute__ ((noreturn));
aa09dcbb 40 virtual void flushAll ();
9f4a0c62
RC
41 virtual ~LogFile();
42 // get a specific verbosity stream.
c83c52d8 43 virtual std::ostream &operator() (enum log_level level);
9f4a0c62
RC
44
45protected:
c83c52d8 46 LogFile(std::stringbuf *aStream);
9f4a0c62
RC
47 LogFile (LogFile const &); // no copy constructor
48 LogFile &operator = (LogFile const&); // no assignment operator
49 virtual void endEntry(); // the current in-progress entry is complete.
5fa64c3c 50 static int exit_msg;
9f4a0c62 51private:
08678720 52 void log_save (int babble, const std::string& filename, bool append);
9f4a0c62 53};
12e726c4 54
5fa64c3c 55#define Logger() ((LogFile &) LogSingleton::GetInstance ())
12e726c4 56#endif /* SETUP_LOGFILE_H */
This page took 0.133137 seconds and 6 git commands to generate.