Giter VIP home page Giter VIP logo

lib-log's Introduction

Nona Log for PHP

A simple library for logging. This library helps remove the boilerplate code required to connect to the remote logging infrustructure by suppling a factory for creating Monolog instances based on a global configuration.

Installation

Install the latest version with: php composer.phar require nona-creative/log

Basic usage

<?php
use Nona\Log\Logger;

$log = Logger::getInstance('demo');
$log->info('Hello world log message');

Advanced usage

<?php
use Nona\Log\LogConfig;
use Nona\Log\Logger;

Logger::setGlobalConfig(new LogConfig('demo-app', 'udp://localhost:5000', 'localhost'));
$log = Logger::getInstance('demo');

$log->info('Hello world log message', ['hello' => 'world']);

The LogConfig Object

Currently the LogConfig object is really basic and only requires 3 parameters.

LogConfig::__construct($applicationName, $host = null, $systemName = null)

When $host is blank, then logs will be output to stdout, which is great for development use. To log to a remote Logstash instance, supply $host with a url, eg: udp://localhost:5000.

If $systemName is left blank, then Monolog will do a lookup to get the local system name.

More Information

As all this is is a factory to manage Monolog, for any logging related information, refer to Monolog on GitHub

lib-log's People

Contributors

skippyza avatar

Stargazers

Paul avatar

Watchers

James Cloos avatar Paul avatar RollYourOwnEd avatar Leo Gopal avatar Ricus Rossouw avatar

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.