PHP code example of xxggabriel / generate-logs

1. Go to this page and download the library: Download xxggabriel/generate-logs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xxggabriel / generate-logs example snippets


 

g\Log;

$log = new Log(__DIR__.'/logs.log');

$msg = "Test error.";
$file = __FILE__;
$line = __LINE__;

// Log de erro.
if(!$log->setMessageError($msg, $file, $line)){
  echo "Erro ao salvar o Log.";
}
// Log de aviso
if(!$log->setWarningMessage($msg, $file, $line)){
  echo "Erro ao salvar o Log.";
}