GithubHelp home page GithubHelp logo

yolk-log's Introduction

Want to work for Gamer Network? We are hiring!

Yolk Logger

Scrutinizer Code Quality

A simple PSR-3 logging library with support for the following outputs:

  • PHP error log
  • Files
  • Null
  • Stdout (CLI only)
  • Stderr (CLI only)
  • Syslog

Requirements

This library requires PHP 5.4 or later, the Yolk Contracts package (gamernetwork/yolk-contracts) and the PSR-3 reference logger (psr/log).

Installation

It is installable and autoloadable via Composer as gamer-network/yolk-logger.

Alternatively, download a release or clone this repository, and add the \yolk\log and \Psr\Log namespaces to an autoloader.

License

Yolk Logger is open-sourced software licensed under the MIT license.

Quick Start

use yolk\log\LogLevel;

// create a factory
$f = new LoggerFactory();

// create some simple logs with default threshold (INFO)
$l = $f->create('php');
$l = $f->create('stderr');
$l = $f->create('stdout');
$l = $f->create('null');

// specify configuration options
$l = $f->create([
	'type' => 'file'
	'file' => '/var/log/php/myapp.log'
]);

$l = $f->create([
	'type'   => 'syslog'
	'prefix' => 'myapp'
]);

// specify a threshold
$l = $f->create([
	'type'      => 'stderr',
	'threshold' => LogLevel::INFO,
]);

// simple message
$l->warning('Ooops! Something went wrong');

// message with context
$l->info(
	"{user} logged in at {time}",
	[
		'user' => 'Gary',
		'time' => '2014-10-02 12:34:56',
	]
);

yolk-log's People

Contributors

simon-downes avatar

Watchers

Dave Hansen avatar James Cloos avatar  avatar  avatar Vicky Stephens avatar Faye Butler avatar Sam Hayes avatar Izzy Smillie avatar Igor avatar  avatar

Forkers

simon-downes

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.