Constants

TYPE_SUCCESS

TYPE_SUCCESS

TYPE_ERROR

TYPE_ERROR

TYPE_NOTICE

TYPE_NOTICE

Properties

$datetime

$datetime : \DateTime

Datetime of the item

Type

\DateTime

$timezone

$timezone : \DateTimeZone

Timezone of the datetime of this item

Type

\DateTimeZone

$message

$message : string

The message of this log item

Type

string

$type

$type : string

Message type

Type

string

Methods

get_item_data()

get_item_data() : array

Get a simple array representation of the item

This is intended to be stored in a persistence layer

Returns

array

set_datetime()

set_datetime(\DateTime  $datetime) 

Parameters

\DateTime $datetime

set_datetimezone()

set_datetimezone(\DateTimeZone  $timezone) 

Parameters

\DateTimeZone $timezone

get_datetime()

get_datetime() : \DateTime

Get datetime of this item, with proper timezone set if applicable

Returns

\DateTime

get_timestamp()

get_timestamp() : integer

Get datetime of this item, in Unix Timestamp and UTC

Returns

integer

get_local_timestamp()

get_local_timestamp() : integer

Same as get_timestamp() but the result is in local timezone

Returns

integer

get_storage_datetime()

get_storage_datetime() : string

Get datetime formatted in a way that's suitable for storage

This should use $datetime with UTC timezone

Returns

string

get_formatted_datetime()

get_formatted_datetime(  $format = 'M d, Y h:i:s A') : string

Get datetime formatted in a way that is suitable for displaying

This should use $datetime with local timezone set

Parameters

$format

Returns

string

__construct()

__construct(string  $message, string  $type, string  $datetime = null) 

Parameters

string $message
string $type
string $datetime

default to now, expect to be in UTC timezone

get_allowed_types()

get_allowed_types() 

get_message()

get_message() 

is_error()

is_error() 

is_success()

is_success() 

is_notice()

is_notice() 

get_type()

get_type()