Logger



( ZN >= 5.0.0 )

The logbook was created to keep the data you want to keep on a file. In previous systems , this operation with report () method has been converted into the structure to be used as class by the specified version. In order to be able to perform the logging process, each project must be activated in its own configuration file.

 

 

# Configuration


File: Config / Project.php

For the system or users to be able to log , it is necessary to set the log -> createFile value to true from the above mentioned file .

LOGAN
Bool $ createFile = false Enables logging.
String $ fileTime = '30 day ' Specifies how long the log records will be stored.

 

 

# Methods


Bool report ( String $ subject , String $ message , String $ destination = NULL , String $ time = NULL )
Bool notice ( String $ message , String $ time = NULL )
Bool emergency ( String $ message , String $ time = NULL )
Bool alert ( String $ message , String $ time = NULL )
Bool error ( String $ message , String $ time = NULL )
Bool warning ( String $ message , String $ time = NULL )
Bool critical ( String $ message , String $ time = NULL )
Bool info ( String $ message , String $ time = NULL )
Bool debug ( String $ message , String $ time = NULL )

 

 

# Report ( ZN> = 5.0.0 )


Used to create log records.

Parameters

String $ subject Record the topic.
String $ Message Record content.
String $ destination = NULL Record purpose.
String $ time = NULL How long the record will be kept. If not specified, the time specified in the configuration file is assumed.
return Bool

Use of

Logger::report('User Login', 'Login Error', 'UserLogin', '10 month');

Above we have kept a record with the Login Error message file UserLogin with User Login and which will be held for 10 months. The path to the generated file is given below.

Created Log File: Storage / Logs / UserLogin.log

 

 

# Other methods ( ZN> = 5.0.0 )


The use of other methods other than the report () above is exactly the same and only includes 2 parameters. These are the content of the recording and the possession of it. Takes the subject and its purpose according to the method name.

Logger::notice('Notice Example Message');
Created Log File: Storage / Logs / notice.log
Logger::warning('Warning Example Message');
Created Log File: Storage / Logs / warning.log

 

 

# Content of a Log File


The contents of the log files generated by the above methods are in a form similar to the following.

IP: 127.0.0.1 | Subject: Example | Date: 10.01.2000 20:00:00 | Message: Log Message
IP: 127.0.0.2 | Subject: Example2 | Date: 10.01.2000 20:00:00 | Message: Log Message2