PHP code example of sharkydog / logger

1. Go to this page and download the library: Download sharkydog/logger 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/ */

    

sharkydog / logger example snippets


public static function error(string $msg, string ...$tags);

public static function destruct($object, string $msg='', string ...$tags);
public static function memory(bool $real=false, string ...$tags);

public static function level(int $level);

Logger::level(Logger::DEBUG);

public static function filter(int $level, callable $filter);

function(string $msg, array $tags, int $level): false|void;

// Print only warning and info
Logger::level(Logger::INFO);
Logger::filter(Logger::ERROR, function($msg,$tags) {
  // do something with errors
});
Logger::filter(Logger::ALL, function($msg,$tags,$level) {
  if($level < Logger::WARNING) return false;
});