Galerkin FEM for elliptic PDEs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

logging.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // ===========================================================================
  2. //
  3. // Filename: logging.h
  4. //
  5. // Description: Simple logging class.
  6. //
  7. // Version: 0.0
  8. // Created: 09/12/2013 03:23:30 PM
  9. // Revision: none
  10. // Compiler: Tested with g++
  11. //
  12. // Author: M. Andy Kass (MAK)
  13. //
  14. // Organisation: US Geological Survey
  15. //
  16. //
  17. // Email: mkass@usgs.gov
  18. //
  19. // This program is free software: you can redistribute it and/or modify
  20. // it under the terms of the GNU General Public License as published by
  21. // the Free Software Foundation, either version 3 of the License, or
  22. // (at your option) any later version.
  23. //
  24. // This program is distributed in the hope that it will be useful,
  25. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. // GNU General Public License for more details.
  28. //
  29. // You should have received a copy of the GNU General Public License
  30. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  31. //
  32. // ===========================================================================
  33. #ifndef __logging_h
  34. #define __logging_h
  35. #include "formalhaut.h"
  36. #include "exceptions.h"
  37. #include <time.h>
  38. namespace formalhaut {
  39. // ===================================================================
  40. // Class: Logging
  41. /// \brief
  42. /// \details
  43. // ===================================================================
  44. class Logging {
  45. friend std::ostream &operator<<(std::ostream &stream,
  46. const Logging &ob);
  47. public:
  48. // ==================== LIFECYCLE =======================
  49. static Logging* New();
  50. void Delete();
  51. // ==================== OPERATORS =======================
  52. // ==================== OPERATIONS =======================
  53. /// Close the log file
  54. void CloseLogFile();
  55. /// Write a single line to the log file
  56. void WriteLogLine(const std::string line);
  57. /// Write header information in the logger
  58. void WriteHeader(const std::string& name,const std::string& ver);
  59. /// Get current date and time, formatted
  60. std::string GetDateTime();
  61. /// Write successful completion
  62. void WriteCloser();
  63. /// Write a long dashed line
  64. void WriteDashedLine();
  65. // ==================== ACCESS =======================
  66. /// Set and open the log file
  67. void SetLogFile(const std::string& fname);
  68. // ==================== INQUIRY =======================
  69. std::string GetLogFile();
  70. protected:
  71. // ==================== LIFECYCLE =======================
  72. /// Default protected constructor.
  73. Logging ();
  74. /// Default protected constructor.
  75. ~Logging ();
  76. // ==================== DATA MEMBERS =========================
  77. // Log file name
  78. std::string LogFile;
  79. // File object
  80. std::ofstream outfile;
  81. private:
  82. }; // ----- end of class Logging -----
  83. } // end of namespace
  84. #endif