123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- // ===========================================================================
- //
- // Filename: logging.h
- //
- // Description: Simple logging class.
- //
- // Version: 0.0
- // Created: 09/12/2013 03:23:30 PM
- // Revision: none
- // Compiler: Tested with g++
- //
- // Author: M. Andy Kass (MAK)
- //
- // Organisation: US Geological Survey
- //
- //
- // Email: mkass@usgs.gov
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- // ===========================================================================
-
- #ifndef __logging_h
- #define __logging_h
-
- #include "formalhaut.h"
- #include "exceptions.h"
- #include <time.h>
-
- namespace formalhaut {
-
-
- // ===================================================================
- // Class: Logging
- /// \brief
- /// \details
- // ===================================================================
- class Logging {
-
- friend std::ostream &operator<<(std::ostream &stream,
- const Logging &ob);
-
- public:
-
- // ==================== LIFECYCLE =======================
-
- static Logging* New();
-
- void Delete();
-
- // ==================== OPERATORS =======================
-
- // ==================== OPERATIONS =======================
-
- /// Close the log file
- void CloseLogFile();
-
- /// Write a single line to the log file
- void WriteLogLine(const std::string line);
-
- /// Write header information in the logger
- void WriteHeader(const std::string& name,const std::string& ver);
-
- /// Get current date and time, formatted
- std::string GetDateTime();
-
- /// Write successful completion
- void WriteCloser();
-
- /// Write a long dashed line
- void WriteDashedLine();
-
- // ==================== ACCESS =======================
-
- /// Set and open the log file
- void SetLogFile(const std::string& fname);
-
- // ==================== INQUIRY =======================
-
- std::string GetLogFile();
-
-
- protected:
-
- // ==================== LIFECYCLE =======================
-
- /// Default protected constructor.
- Logging ();
-
- /// Default protected constructor.
- ~Logging ();
-
- // ==================== DATA MEMBERS =========================
-
- // Log file name
- std::string LogFile;
-
- // File object
- std::ofstream outfile;
-
- private:
-
- }; // ----- end of class Logging -----
-
- } // end of namespace
- #endif
|