Apache Log4cxx  Version 1.8.0
log4cxx::pattern::CachedDateFormat Class Reference

#include <cacheddateformat.h>

Inheritance diagram for log4cxx::pattern::CachedDateFormat:
log4cxx::helpers::DateFormat log4cxx::helpers::Object

Public Types

enum  { NO_MILLISECONDS = -2 , UNRECOGNIZED_MILLISECONDS = -1 }
 

Public Member Functions

 CachedDateFormat (const helpers::DateFormatPtr &dateFormat, int expiration)
 Creates a new CachedDateFormat object. More...
 
 ~CachedDateFormat ()
 
void format (LogString &toAppendTo, log4cxx_time_t tm, helpers::Pool &p) const override
 Formats a Date into a date/time string. More...
 
void setTimeZone (const helpers::TimeZonePtr &zone) override
 Set timezone. More...
 
void numberFormat (LogString &toAppendTo, int n, helpers::Pool &p) const override
 Format an integer consistent with the format method. More...
 
- Public Member Functions inherited from log4cxx::helpers::DateFormat
virtual ~DateFormat ()
 Destructor. More...
 
void format (LogString &toAppendTo, log4cxx_time_t tm) const
 
virtual void setTimeZone (const TimeZonePtr &zone)
 Sets the time zone. More...
 
void numberFormat (LogString &toAppendTo, int n) const
 Format an integer consistent with the format method. More...
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual const helpers::ClassgetClass () const =0
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Static Public Member Functions

static int findMillisecondStart (log4cxx_time_t time, const LogString &formatted, const helpers::DateFormatPtr &formatter)
 Finds start of millisecond field in formatted time. More...
 
static int findMillisecondStart (log4cxx_time_t time, const LogString &formatted, const log4cxx::helpers::DateFormatPtr &formatter, log4cxx::helpers::Pool &pool)
 
static int getMaximumCacheValidity (const LogString &pattern)
 Gets maximum cache validity for the specified SimpleDateTime conversion pattern. More...
 

Additional Inherited Members

- Protected Member Functions inherited from log4cxx::helpers::DateFormat
 DateFormat ()
 Constructor. More...
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NO_MILLISECONDS 
UNRECOGNIZED_MILLISECONDS 

Constructor & Destructor Documentation

◆ CachedDateFormat()

log4cxx::pattern::CachedDateFormat::CachedDateFormat ( const helpers::DateFormatPtr &  dateFormat,
int  expiration 
)

Creates a new CachedDateFormat object.

Parameters
dateFormatDate format, may not be null.
expirationmaximum cached range in microseconds. If the dateFormat is known to be incompatible with the caching algorithm, use a value of 0 to totally disable caching or 1 to only use cache for duplicate requests.

◆ ~CachedDateFormat()

log4cxx::pattern::CachedDateFormat::~CachedDateFormat ( )

Member Function Documentation

◆ findMillisecondStart() [1/2]

static int log4cxx::pattern::CachedDateFormat::findMillisecondStart ( log4cxx_time_t  time,
const LogString formatted,
const helpers::DateFormatPtr &  formatter 
)
static

Finds start of millisecond field in formatted time.

Parameters
timelong time, must be integral number of seconds
formattedString corresponding formatted string
formatterDateFormat date format
Returns
int position in string of first digit of milliseconds, -1 indicates no millisecond field, -2 indicates unrecognized field (likely RelativeTimeDateFormat)

◆ findMillisecondStart() [2/2]

static int log4cxx::pattern::CachedDateFormat::findMillisecondStart ( log4cxx_time_t  time,
const LogString formatted,
const log4cxx::helpers::DateFormatPtr &  formatter,
log4cxx::helpers::Pool pool 
)
static

◆ format()

void log4cxx::pattern::CachedDateFormat::format ( LogString toAppendTo,
log4cxx_time_t  tm,
helpers::Pool p 
) const
overridevirtual

Formats a Date into a date/time string.

Parameters
tmthe date/time to format.
toAppendTothe string buffer to write to.

Implements log4cxx::helpers::DateFormat.

◆ getMaximumCacheValidity()

static int log4cxx::pattern::CachedDateFormat::getMaximumCacheValidity ( const LogString pattern)
static

Gets maximum cache validity for the specified SimpleDateTime conversion pattern.

Parameters
patternconversion pattern, may not be null.
Returns
Duration in microseconds from an integral second that the cache will return consistent results.

◆ numberFormat()

void log4cxx::pattern::CachedDateFormat::numberFormat ( LogString toAppendTo,
int  n,
helpers::Pool p 
) const
overridevirtual

Format an integer consistent with the format method.

Parameters
toAppendTostring to which the numeric string is appended.
ninteger value.

Reimplemented from log4cxx::helpers::DateFormat.

◆ setTimeZone()

void log4cxx::pattern::CachedDateFormat::setTimeZone ( const helpers::TimeZonePtr &  zone)
override

Set timezone.

Remarks
Setting the timezone using getCalendar().setTimeZone() will likely cause caching to misbehave.
Parameters
zoneTimeZone new timezone

The documentation for this class was generated from the following file: