FileTarget

Type
Class
Namespace
craft\log
Inherits
craft\log\FileTarget » yii\log\FileTarget » yii\log\Target » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Since
3.0

Class FileTarget

View source

Public Properties

PropertyDescription
$behaviorsyii\base\Behavior – List of behaviors attached to this component
$categoriesarray – List of message categories that this target is interested in.
$dirModeinteger – The permission to be set for newly created directories.
$enableRotationboolean – Whether log files should be rotated when they reach a certain maximum size.
$enabledboolean, callable – A boolean value or a callable to obtain the value from.
$exceptarray – List of message categories that this target is NOT interested in.
$exportIntervalinteger – How many messages should be accumulated before they are exported.
$fileModeinteger – The permission to be set for newly created log files.
$levelsinteger – The message levels that this target is interested in.
$logFilestring – Log file path or path alias.
$logVarsarray – List of the PHP predefined variables that should be logged in a message.
$maxFileSizeinteger – Maximum log file size, in kilo-bytes.
$maxLogFilesinteger – Number of log files used for rotation.
$messagesarray – The messages that are retrieved from the logger so far by this log target.
$microtimeboolean – Whether to log time with microseconds.
$prefixcallable – A PHP callable that returns a string to be prefixed to every exported message.
$rotateByCopyboolean – Whether to rotate log files by copy and truncate in contrast to rotation by renaming files.

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__clone()This method is called after the object is created by cloning an existing one.
__construct()Constructor.
__get()Returns the value of an object property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets value of an object property.
__unset()Sets an object property to null.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
behaviors()Returns a list of behaviors that this component should behave as.
canGetProperty()Returns a value indicating whether a property can be read.
canSetProperty()Returns a value indicating whether a property can be set.
className()Returns the fully qualified name of this class.
collect()Processes the given log messages.
detachBehavior()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
ensureBehaviors()Makes sure that the behaviors declared in behaviors() are attached to this component.
export()Writes log messages to a file.
filterMessages()Filters the given messages according to their categories and levels.
formatMessage()Formats a log message for display as a string.
getBehavior()Returns the named behavior object.
getBehaviors()Returns all behaviors attached to this component.
getEnabled()Check whether the log target is enabled.
getLevels()
getMessagePrefix()Returns a string to be prefixed to the given message.
hasEventHandlers()Returns a value indicating whether there is any handler attached to the named event.
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined.
init()Initializes the object.
off()Detaches an existing event handler from this component.
on()Attaches an event handler to an event.
setEnabled()Sets a value indicating whether this log target is enabled.
setLevels()Sets the message levels that this target is interested in.
trigger()Triggers an event.

Protected Methods

MethodDescription
getContextMessage()Generates the context information to be logged.
getTime()Returns formatted ('Y-m-d H:i:s') timestamp for message.
rotateFiles()Rotates log files.

getContextMessage()

Generates the context information to be logged.

The default implementation will dump user information, system variables, etc.

View source

Returns

string – The context information. If an empty string, it means no context information.

Signature

protected string getContextMessage ( )