1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/base/LogControl.h
12 #ifndef ZYPP_BASE_LOGCONTROL_H
13 #define ZYPP_BASE_LOGCONTROL_H
17 #include "zypp/base/PtrTypes.h"
18 #include "zypp/Pathname.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////
29 // CLASS NAME : LogControl
31 /** Maintain logfile related options.
32 * \note A Singleton using a Singleton implementation class,
33 * that's why there is no _pimpl like in other classes.
37 friend std::ostream & operator<<( std::ostream & str, const LogControl & obj );
40 /** Singleton access. */
41 static LogControl instance()
42 { return LogControl(); }
45 /** If you want to log the (formated) loglines by yourself,
46 * derive from this, and overload \c writeOut. */
49 virtual void writeOut( const std::string & /*formated_r*/ )
52 virtual ~LineWriter() {}
56 /** Set path for the logfile.
57 * An emty pathname for std::err.
58 * \throw if \a logfile_r is not usable.
60 void logfile( const Pathname & logfile_r );
66 /** Assign a LineWriter.
67 * If you want to log the (formated) loglines by yourself. */
68 void setLineWriter( const shared_ptr<LogControl::LineWriter> & writer_r );
71 /** Turn on excessive logging for the lifetime of this object.*/
79 /** Default ctor: Singleton */
83 ///////////////////////////////////////////////////////////////////
85 /** \relates LogControl Stream output */
86 std::ostream & operator<<( std::ostream & str, const LogControl & obj );
88 /////////////////////////////////////////////////////////////////
90 ///////////////////////////////////////////////////////////////////
91 /////////////////////////////////////////////////////////////////
93 ///////////////////////////////////////////////////////////////////
94 #endif // ZYPP_BASE_LOGCONTROL_H