- Symphony 2.3
-
› assets
8 -
› boot
9 -
› core
22 -
› email-gateways
3 -
› global
34 -
› interface
1 -
› toolkit
69 - Delegates89
- Deprecated27
Versions
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.3
- 2.7.2
- 2.7.10
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.11
- 2.6.10
- 2.6.1
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
Options
public class Log
class.log.php #13The Log class acts a simple wrapper to write errors to a file so that it can
be read at a later date. There is one Log file in Symphony, stored in the main
LOGS
directory.
Constants
static integer APPEND = 10
A constant for if this message should add to an existing log file
static integer OVERWRITE = 11
A constant for if this message should overwrite the existing log
Methods
void __construct(
$path)
The log constructor takes a path to the folder where the Log should be written to.
Parameters
void close()
Writes a end of file block at the end of the log file with a datetime stamp of when the log file was closed.
array getLog()
Accessor for the $_log
.
string getLogPath()
Accessor for the $_log_path
.
void initialise(
$name)
integer open(
$flag, $mode)
The function handles the rotation of the log files. By default it will open
the current log file, 'main', which is written to $_log_path
and
check it's file size doesn't exceed $_max_size
. If it does, the log
is appended with a date stamp and if $_archive
has been set, it will
be archived and stored. If a log file has exceeded it's size, or Log::OVERWRITE
flag is set, the existing log file is removed and a new one created. Essentially,
if a log file has not reached it's $_max_size
and the the flag is not
set to Log::OVERWRITE
, this function does nothing.
Parameters
Returns
Returns 1 if the log was overwritten, or 2 otherwise.
See Also
array popFromLog()
Function will return the last message added to $_log
and remove
it from the array.
Returns
Returns an associative array of a log message, containing the type of the log message, the actual message and the time at the which it was added to the log
mixed pushToLog(
$message, $type, $writeToLog, $addbreak, $append)
Given a message, this function will add it to the internal $_log
so that it can be written to the Log. Optional parameters all the message to
be immediately written, insert line breaks or add to the last log message
Parameters
Returns
If $writeToLog
is passed, this function will return boolean, otherwise void
void setArchive(
$archive)
Setter for the $_archive
.
Parameters
void setDateTimeFormat(
$format)
Setter for the $_date_format
.
Parameters
See Also
void setLogPath(
$path)
Setter for the $_log_path
.
Parameters
void setMaxSize(
$size)
Setter for the $_max_size
.
Parameters
boolean writeToLog(
$message, $addbreak)
This function will write the given message to the log file. Messages will be appended the existing log file.
Parameters
Returns
Returns true if the message was written successfully, false otherwise