nux-1.16.0
|
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- 00002 /* 00003 * Copyright 2011 Inalogic® Inc. 00004 * 00005 * This program is free software: you can redistribute it and/or modify it 00006 * under the terms of the GNU Lesser General Public License, as 00007 * published by the Free Software Foundation; either version 2.1 or 3.0 00008 * of the License. 00009 * 00010 * This program is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranties of 00012 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 00013 * PURPOSE. See the applicable version of the GNU Lesser General Public 00014 * License for more details. 00015 * 00016 * You should have received a copy of both the GNU Lesser General Public 00017 * License along with this program. If not, see <http://www.gnu.org/licenses/> 00018 * 00019 * Authored by: Tim Penhey <tim.penhey@canonical.com> 00020 * 00021 */ 00022 #ifndef NUX_CORE_LOGGING_WRITER_H 00023 #define NUX_CORE_LOGGING_WRITER_H 00024 00025 #include <iosfwd> 00026 #include <ctime> 00027 #include <boost/utility.hpp> 00028 00029 #include "Logger.h" 00042 namespace nux { 00043 namespace logging { 00044 00045 class Writer : boost::noncopyable 00046 { 00047 public: 00048 static Writer& Instance(); 00049 ~Writer(); 00050 00051 void WriteMessage(Level severity, 00052 std::string const& module, 00053 std::string const& filename, 00054 int line_number, 00055 std::time_t timestamp, 00056 std::string const& message); 00057 00058 void SetOutputStream(std::ostream& out); 00059 00060 private: 00061 Writer(); 00062 00063 private: 00064 class Impl; 00065 Impl* pimpl; 00066 }; 00067 00068 } 00069 } 00070 00071 #endif