Giter VIP home page Giter VIP logo

phplogger's Introduction

PHPLogger

A configurable Logger for PHP applications.

Setup Instructions

  • add the relevant repository in your composer.json like so:

     "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/tobbykuyinu/phplogger"
        }
     ]
    
  • require the logger as a dependency using the command:

    composer require tobbykuyinu/phplogger

    Alternatively, you can include the package as a dependency in the composer.json file like so:

    "require": {
         "tobbykuyinu/phplogger": "^1.0"
     }
    

    Then run composer install afterwards

Usage

  • Assuming the (above) setup has been completed, here's a sample implementation of the logger:

    use \Tobby\PhpLogger\Logger;
    
    $logger = new Logger(['file' => 'logs/log.log', 'level' => 'debug', 'console' => false]);
    $logger->info("Info message");
    $logger->debug('Debug message');
    $logger->notice('Notice message');
    $logger->warning('Warning message');
    $logger->critical('Critical message');
    $logger->alert('Alert message');
    $logger->error('Error message', ['a' => 'context data', 'b' => 'more context data']);
    $logger->emergency('Emergency message');
    $logger->log('info', 'Info message');
    

    Only the file configuration array field is required. level defaults to info and console defaults to true Set console to false to prevent logging on the terminal (for example during script executions)

phplogger's People

Contributors

tobby-carmudi avatar tobbykuyinu avatar

Watchers

James Cloos avatar  avatar

Forkers

tobby-carmudi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.