Class: Log
Source Location: /myphp-1.9/myphp-1.9-log/html/util/Log.php
Class Log
Class Overview
|
Log facility utilizing the function error_log()
- Usage:
- Log::insert(__FILE__,__LINE__,$myInsertMessage); // SQL
- Log::update(__FILE__,__LINE__,$myUpdateMessage);
- Log::delete(__FILE__,__LINE__,$myDeleteMessage);
- Log::query (__FILE__,__LINE__,$myQueryMessage);
-
- Log::debug (__FILE__,__LINE__,$myDebugMessage);
- Log::info (__FILE__,__LINE__,$myInfoMessage);
- Log::warn (__FILE__,__LINE__,$myWarnMessage);
- Log::error (__FILE__,__LINE__,$myErrorMessage);
- Log::fatal (__FILE__,__LINE__,$myFatalMessage);
-
- Log::email (__FILE__,__LINE__,$myEmailMessage); // Email
- Log::sms (__FILE__,__LINE__,$mySmsMessage); // SMS
-
- Log::referer($info); // Log referer info, where did the user came from
- Log::domain ($info); // Log domain info, where did user come from
- Log::phrase ($info); // Log phase info, what did user seached for
-
- Log::user(); // Log user data
-
- Log::getRequestInfo();
Located in /myphp-1.9/myphp-1.9-log/html/util/Log.php [line 49]
|
Methods
|
Method Summary
| void |
add() |
Add an entry to the log file |
| boolean |
isEnabled() |
Check to se, if the requested log level is active or not |
| String |
mkdir() |
Create a new log directory $path.'/'.$name or |
| void |
user() |
Add an entry to the log file with the request params |
Methods
void add(
String
$file, String
$line, [String
$text = ''], [String
$level = '']
)
|
|
Add an entry to the log file
- Usage:
- Log::add($file,$line,$text,$level);
- The funtion will log the data with a filename as
- no-level-hostname.log where
- no, is a number from 0-365 (day of the year)
- level, is the log level defined i.e. ERROR
- hostname, is the domain host name
Parameters:
|
String |
$file: |
The file name, use: __FILE__ |
|
String |
$line: |
The line number, use: __LINE__ |
|
String |
$text: |
The text to log |
|
String |
$level: |
The log level to log |
API Tags:
void debug(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void delete(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void domain(
[mixed
$text = '']
)
|
|
void email(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void error(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void fatal(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
String getLevelName(
mixed
$level, String
$level,
)
|
|
Get the level name
Get the name of the current loglevel
Parameters:
|
String |
$level,: |
The log level to use |
API Tags:
| Return: | The name of the log level |
| Static: | |
Get the request information
API Tags:
| Return: | The request as a string |
| Static: | |
void info(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void insert(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
boolean isEnabled(
[int
$level = LOG_LEVEL_DEBUG]
)
|
|
Check to se, if the requested log level is active or not
Parameters:
|
int |
$level: |
The level to check. I.e. LOG_LEVEL_DEBUG |
API Tags:
| Return: | True if active, else false |
| Static: | |
String mkdir(
String
$path, String
$name
)
|
|
Create a new log directory $path.'/'.$name or
return the name of log directory if already exists
Parameters:
|
String |
$path: |
The path of the existing log directory |
|
String |
$name: |
The name of the new directory to use |
API Tags:
| Return: | The name of the new log directory or the old one |
| Static: | |
void phrase(
[mixed
$text = '']
)
|
|
void query(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void referer(
[String
$text = ''], String
$file, String
$line, String
$level
)
|
|
Helper function
Parameters:
|
String |
$file: |
The file, use __FILE__ |
|
String |
$line: |
The line, use __LINE__ |
|
String |
$text: |
The text to log |
|
String |
$level: |
The log level to use |
API Tags:
void sms(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void update(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
void user(
[String
$text = '']
)
|
|
Add an entry to the log file with the request params
Parameters:
|
String |
$text: |
The text to log |
API Tags:
void warn(
mixed
$file, mixed
$line, [mixed
$text = '']
)
|
|
|
|