X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FFileTarget.hh;h=5f3082e64075fb78ae0d85861889745d61bc5f60;hb=87ee88924d6f07408ef02ddb439394a47882c765;hp=cd5c71a126eb6103736f7f9fbac2bec4ac4f1dda;hpb=a1a6c76a214ad1935032826713cabaf9ac57bf07;p=senf.git diff --git a/Utils/Logger/FileTarget.hh b/Utils/Logger/FileTarget.hh index cd5c71a..5f3082e 100644 --- a/Utils/Logger/FileTarget.hh +++ b/Utils/Logger/FileTarget.hh @@ -23,11 +23,12 @@ /** \file \brief FileTarget public header */ -#ifndef HH_FileTarget_ -#define HH_FileTarget_ 1 +#ifndef HH_SENF_Utils_Logger_FileTarget_ +#define HH_SENF_Utils_Logger_FileTarget_ 1 // Custom includes #include +#include #include #include "IOStreamTarget.hh" @@ -35,6 +36,9 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { + + namespace console { class DirectoryNode; } + namespace log { /** \brief Log target writing to a %log file. @@ -42,6 +46,13 @@ namespace log { The FileTarget will save all %log messages in the given file. Messages will be appended at the end of the file. + \code + senf::log::FileTarget target ("file.name"); + + // Route all messages to this file. + target.route(); + \endcode + After %log files have been rotated, the reopen() member should be called to create a new %log file. @@ -58,16 +69,24 @@ namespace log { ///\name Structors and default members ///@{ - explicit FileTarget(std::string file); ///< Construct FileTarget writing to \a file + explicit FileTarget(std::string const & filename, std::string const & nodename = ""); + ///< Construct FileTarget writing to \a file ///@} /////////////////////////////////////////////////////////////////////////// void reopen(); ///< Reopen %log after log-file rotation - void reopen(std::string file); ///< Reopen %log under a new name + void reopen(std::string const & file); ///< Reopen %log under a new name private: std::string file_; + + struct RegisterConsole { + RegisterConsole(); + static boost::shared_ptr create( + std::string const & filename, std::string const & nodename); + static RegisterConsole instance; + }; }; }}