layout.h
Go to the documentation of this file.
// -*- C++ -*-
// Module: Log4CPLUS
// File: Layout.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LOG4CPLUS_LAYOUT_HEADER_
#define LOG4CPLUS_LAYOUT_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <log4cplus/loglevel.h>
#include <log4cplus/streams.h>
#include <log4cplus/tstring.h>
#include <log4cplus/helpers/timehelper.h>
#include <vector>
#include <memory>
namespace log4cplus {
// Forward Declarations
namespace pattern
{
class PatternConverter;
}
namespace helpers
{
class Properties;
}
namespace spi
{
class InternalLoggingEvent;
}
class LOG4CPLUS_EXPORT Layout
{
public:
Layout();
Layout(const helpers::Properties& properties);
virtual ~Layout() = 0;
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event) = 0;
protected:
LogLevelManager& llmCache;
private:
// Disable copy
Layout(const Layout&);
Layout& operator=(Layout const &);
};
class LOG4CPLUS_EXPORT SimpleLayout
: public Layout
{
public:
SimpleLayout();
SimpleLayout(const log4cplus::helpers::Properties& properties);
virtual ~SimpleLayout();
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event);
private:
// Disallow copying of instances of this class
SimpleLayout(const SimpleLayout&);
SimpleLayout& operator=(const SimpleLayout&);
};
class LOG4CPLUS_EXPORT TTCCLayout
: public Layout
{
public:
TTCCLayout(bool use_gmtime = false, bool thread_printing = true,
bool category_prefixes = true, bool context_printing = true);
TTCCLayout(const log4cplus::helpers::Properties& properties);
virtual ~TTCCLayout();
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event);
bool getThreadPrinting() const;
void setThreadPrinting(bool);
bool getCategoryPrefixing() const;
void setCategoryPrefixing(bool);
bool getContextPrinting() const;
void setContextPrinting(bool);
protected:
log4cplus::tstring dateFormat;
bool use_gmtime = false;
bool thread_printing = true;
bool category_prefixing = true;
bool context_printing = true;
private:
// Disallow copying of instances of this class
TTCCLayout(const TTCCLayout&);
TTCCLayout& operator=(const TTCCLayout&);
};
LOG4CPLUS_EXPORT helpers::Time const & getTTCCLayoutTimeBase ();
class LOG4CPLUS_EXPORT PatternLayout
: public Layout
{
public:
// Ctors and dtor
PatternLayout(const log4cplus::tstring& pattern);
PatternLayout(const log4cplus::helpers::Properties& properties);
virtual ~PatternLayout();
virtual void formatAndAppend(log4cplus::tostream& output,
const log4cplus::spi::InternalLoggingEvent& event);
protected:
void init(const log4cplus::tstring& pattern, unsigned ndcMaxDepth = 0);
// Data
log4cplus::tstring pattern;
std::vector<std::unique_ptr<pattern::PatternConverter> > parsedPattern;
private:
// Disallow copying of instances of this class
PatternLayout(const PatternLayout&);
PatternLayout& operator=(const PatternLayout&);
};
} // end namespace log4cplus
#endif // LOG4CPLUS_LAYOUT_HEADER_
log4cplus::Layout::Layout
Layout(const helpers::Properties &properties)
log4cplus::Layout::~Layout
virtual ~Layout()=0
log4cplus::Layout::llmCache
LogLevelManager & llmCache
Definition layout.h:84
log4cplus::Layout::formatAndAppend
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)=0
log4cplus::Layout::Layout
Layout()
log4cplus::LogLevelManager
This class is used to "manage" LogLevel definitions.
Definition loglevel.h:130
log4cplus::PatternLayout::parsedPattern
std::vector< std::unique_ptr< pattern::PatternConverter > > parsedPattern
Definition layout.h:633
log4cplus::PatternLayout::PatternLayout
PatternLayout(const log4cplus::tstring &pattern)
log4cplus::PatternLayout::pattern
log4cplus::tstring pattern
Definition layout.h:632
log4cplus::PatternLayout::formatAndAppend
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)
log4cplus::PatternLayout::PatternLayout
PatternLayout(const log4cplus::helpers::Properties &properties)
log4cplus::PatternLayout::init
void init(const log4cplus::tstring &pattern, unsigned ndcMaxDepth=0)
log4cplus::PatternLayout::~PatternLayout
virtual ~PatternLayout()
log4cplus::SimpleLayout::~SimpleLayout
virtual ~SimpleLayout()
log4cplus::SimpleLayout::SimpleLayout
SimpleLayout()
log4cplus::SimpleLayout::SimpleLayout
SimpleLayout(const log4cplus::helpers::Properties &properties)
log4cplus::SimpleLayout::formatAndAppend
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)
log4cplus::TTCCLayout::getContextPrinting
bool getContextPrinting() const
log4cplus::TTCCLayout::setCategoryPrefixing
void setCategoryPrefixing(bool)
log4cplus::TTCCLayout::setContextPrinting
void setContextPrinting(bool)
log4cplus::TTCCLayout::thread_printing
bool thread_printing
Definition layout.h:189
log4cplus::TTCCLayout::setThreadPrinting
void setThreadPrinting(bool)
log4cplus::TTCCLayout::use_gmtime
bool use_gmtime
Definition layout.h:188
log4cplus::TTCCLayout::getCategoryPrefixing
bool getCategoryPrefixing() const
log4cplus::TTCCLayout::TTCCLayout
TTCCLayout(const log4cplus::helpers::Properties &properties)
log4cplus::TTCCLayout::category_prefixing
bool category_prefixing
Definition layout.h:190
log4cplus::TTCCLayout::context_printing
bool context_printing
Definition layout.h:191
log4cplus::TTCCLayout::formatAndAppend
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)
log4cplus::TTCCLayout::~TTCCLayout
virtual ~TTCCLayout()
log4cplus::TTCCLayout::TTCCLayout
TTCCLayout(bool use_gmtime=false, bool thread_printing=true, bool category_prefixes=true, bool context_printing=true)
log4cplus::TTCCLayout::dateFormat
log4cplus::tstring dateFormat
Definition layout.h:187
log4cplus::TTCCLayout::getThreadPrinting
bool getThreadPrinting() const
log4cplus::helpers::Properties
Definition property.h:43
log4cplus::spi::InternalLoggingEvent
The internal representation of logging events.
Definition loggingevent.h:51
config.hxx
loglevel.h
This header defines the LogLevel type.
log4cplus::helpers
Definition appender.h:50
log4cplus::helpers::Time
chrono::time_point< Clock, Duration > Time
Definition timehelper.h:54
log4cplus::pattern
Definition layout.h:46
log4cplus::spi
Definition layout.h:62
log4cplus
Definition appender.h:46
log4cplus::tstring
std::basic_string< tchar > tstring
Definition tstring.h:39
log4cplus::tostream
std::basic_ostream< tchar > tostream
Definition streams.h:40
log4cplus::getTTCCLayoutTimeBase
LOG4CPLUS_EXPORT helpers::Time const & getTTCCLayoutTimeBase()
streams.h
timehelper.h
tstring.h
LOG4CPLUS_EXPORT
#define LOG4CPLUS_EXPORT
Definition win32.h:141