Creating Logs & Using Logger Class
Required Namespace
  • Ness
    • Log
      • Logger

  • Ness
    • Log
      • LogTypeProvider

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
                            

  1. Log Types for Parameter $type;
    1. LogTypeProvider::Error()
    2. LogTypeProvider::Warning()
    3. 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