Creating Logs & Using Logger Class
You can include this library to your code file by typing the below code;
use Ness\Log\Logger
use Ness\Log\LogTypeProvider
- Contents
Required Namespace
- Ness
- Log
- Logger
- Log
- Ness
- Log
- LogTypeProvider
- Log
You can include this library to your code file by typing the below code;
use Ness\Log\Logger
use Ness\Log\LogTypeProvider
About Logs & Logging in Ness PHP #top
This class is used to generate logs. You can use the functions of class for creating Error files, warning files or output messages. Created txt files will be located in 'Output' folder of your application.
Create Logs #top
Create an output log file.
Logger::Output(LogTypeProvider $type, string $title,string $msg ) : void
-
Log Types for Parameter $type;
- LogTypeProvider::Error()
- LogTypeProvider::Warning()
- LogTypeProvider::OutputMessage()
Example
Create a log when user is loged in;
if(isUserActive()){
Logger::Output(LogTypeProvider::OutputMessage(), "Log-in Action", "{@sessiondata['username']} is logged in. Date & Time:".date());
}
Header #top
Clear Log Files. If you do not set a parameter to function all logs will be cleared.
Logger::ClearLogs(LogTypeProvider $type) : void
Do not set a type for clearing all log files