Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# layout.h

Go to the documentation of this file.

    00001 // Module:  Log4CPLUS
    00002 // File:    Layout.h
    00003 // Created: 6/2001
    00004 // Author:  Tad E. Smith
    00005 //
    00006 //
    00007 // Copyright (C) Tad E. Smith  All rights reserved.
    00008 //
    00009 // This software is published under the terms of the Apache Software
    00010 // License version 1.1, a copy of which has been included with this
    00011 // distribution in the LICENSE.APL file.
    00012 //
    00013
    00016 #ifndef _LOG4CPLUS_LAYOUT_HEADER_
    00017 #define _LOG4CPLUS_LAYOUT_HEADER_
    00018
    00019 #include <log4cplus/config.h>
    00020 #include <log4cplus/loglevel.h>
    00021 #include <log4cplus/streams.h>
    00022 #include <log4cplus/tstring.h>
    00023 #include <log4cplus/helpers/logloguser.h>
    00024 #include <log4cplus/helpers/property.h>
    00025 #include <log4cplus/helpers/timehelper.h>
    00026 #include <log4cplus/spi/loggingevent.h>
    00027
    00028 #include <vector>
    00029
    00030
    00031 namespace log4cplus {
    00032
    00033     // Forward Declarations
    00034     namespace pattern {
    00035         class PatternConverter;
    00036     }
    00037
    00038
    00043     class LOG4CPLUS_EXPORT Layout : protected :: log4cplus::helpers::LogLogUser {
    00044     public:
    00045         Layout() : llmCache(getLogLevelManager()) {}
    00046         Layout(const log4cplus::helpers::Properties&)
    00047           : llmCache(getLogLevelManager())  {}
    00048         virtual ~Layout() {}
    00049
    00050         virtual void formatAndAppend(log4cplus::tostream& output,
    00051                                      const log4cplus::spi::InternalLoggingEvent& event) = 0;
    00052     protected:
    00053         LogLevelManager& llmCache;
    00054
    00055     private:
    00056       // Disable copy
    00057         Layout(const Layout&);
    00058         Layout& operator=(Layout&);
    00059     };
    00060
    00061
    00062
    00075     class LOG4CPLUS_EXPORT SimpleLayout : public Layout {
    00076     public:
    00077         SimpleLayout() {}
    00078         SimpleLayout(const log4cplus::helpers::Properties& properties) : Layout(properties) {}
    00079
    00080         virtual void formatAndAppend(log4cplus::tostream& output,
    00081                                      const log4cplus::spi::InternalLoggingEvent& event);
    00082
    00083     private:
    00084       // Disallow copying of instances of this class
    00085         SimpleLayout(const SimpleLayout&);
    00086         SimpleLayout& operator=(const SimpleLayout&);
    00087     };
    00088
    00089
    00090
    00127     class LOG4CPLUS_EXPORT TTCCLayout : public Layout {
    00128     public:
    00129       // Ctor and dtor
    00130         TTCCLayout(bool use_gmtime = false);
    00131         TTCCLayout(const log4cplus::helpers::Properties& properties);
    00132         virtual ~TTCCLayout();
    00133
    00134         virtual void formatAndAppend(log4cplus::tostream& output,
    00135                                      const log4cplus::spi::InternalLoggingEvent& event);
    00136
    00137     protected:
    00138        log4cplus::tstring dateFormat;
    00139        bool use_gmtime;
    00140
    00141     private:
    00142       // Disallow copying of instances of this class
    00143         TTCCLayout(const TTCCLayout&);
    00144         TTCCLayout& operator=(const TTCCLayout&);
    00145     };
    00146
    00147
    00148
    00149
    00461     class LOG4CPLUS_EXPORT PatternLayout : public Layout {
    00462     public:
    00463       // Ctors and dtor
    00464         PatternLayout(const log4cplus::tstring& pattern);
    00465         PatternLayout(const log4cplus::helpers::Properties& properties);
    00466         virtual ~PatternLayout();
    00467
    00468         virtual void formatAndAppend(log4cplus::tostream& output,
    00469                                      const log4cplus::spi::InternalLoggingEvent& event);
    00470
    00471     protected:
    00472         void init(const log4cplus::tstring& pattern);
    00473
    00474       // Data
    00475         log4cplus::tstring pattern;
    00476         std::vector<pattern::PatternConverter*> parsedPattern;
    00477
    00478     private:
    00479       // Disallow copying of instances of this class
    00480         PatternLayout(const PatternLayout&);
    00481         PatternLayout& operator=(const PatternLayout&);
    00482     };
    00483
    00484
    00485
    00486 } // end namespace log4cplus
    00487
    00488 #endif // _LOG4CPLUS_LAYOUT_HEADER_
    00489