FileTarget

Type
Class
Namespace
craft\log
Inherits
craft\log\FileTarget » yii\log\FileTarget (opens new window) » yii\log\Target (opens new window) » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window)
Uses traits
craft\base\LogTargetTrait
Since
3.0.0

Class FileTarget

View source (opens new window)

# Public Properties

Property Description
behaviors (opens new window) yii\base\Behavior (opens new window) – List of behaviors attached to this component.
categories (opens new window) array (opens new window) – List of message categories that this target is interested in.
dirMode (opens new window) integer (opens new window) – The permission to be set for newly created directories.
enableRotation (opens new window) boolean (opens new window) – Whether log files should be rotated when they reach a certain maximum size (opens new window).
enabled (opens new window) boolean (opens new window) – Indicates whether this log target is enabled.
except (opens new window) array (opens new window) – List of message categories that this target is NOT interested in.
exportInterval (opens new window) integer (opens new window) – How many messages should be accumulated before they are exported.
fileMode (opens new window) integer (opens new window), null (opens new window) – The permission to be set for newly created log files.
includeUserIp boolean (opens new window) – Whether the user IP should be included in the default log prefix.
levels (opens new window) integer (opens new window) – The message levels that this target is interested in.
logFile (opens new window) string (opens new window), null (opens new window) – Log file path or path alias.
logVars (opens new window) array (opens new window) – List of the PHP predefined variables that should be logged in a message.
maskVars (opens new window) array (opens new window) – List of the PHP predefined variables that should NOT be logged "as is" and should always be replaced with a mask *** before logging, when exist.
maxFileSize (opens new window) integer (opens new window) – Maximum log file size, in kilo-bytes.
maxLogFiles (opens new window) integer (opens new window) – Number of log files used for rotation.
messages (opens new window) array (opens new window) – The messages that are retrieved from the logger so far by this log target.
microtime (opens new window) boolean (opens new window) – Whether to log time with microseconds.
prefix (opens new window) callable (opens new window), null (opens new window) – A PHP callable that returns a string to be prefixed to every exported message.
rotateByCopy (opens new window) boolean (opens new window) – Whether to rotate log files by copy and truncate in contrast to rotation by renaming files.

# Public Methods

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

# Protected Methods

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