Coder Social home page Coder Social logo

glogger's Introduction

GLogger

Project created by Greg Dean

About

Glogger is a simple logger class implementing Klogger. It's basically a wrapper. The purpose of this was a simpler way to use Klogger throughout an application. Constants are now used which allows easier management, configurability and ease of use.

Installation

Installation is done strictly with Composer and loaded with it's autoload feature.

composer require gonzoinc/glogger

In your composer.json:

{
    "require": {
        "gonzoinc/glogger": "1.0.0"
    }
}

Usage

Check Sample file for working example of the class and examples of the various logging levels.

The Constants used are defined in the init.php file. Be sure to copy them over to your application and set them as needed.

<?php

require_once "init.php";

// Composer required modules
require_once 'vendor/autoload.php';

use Glogger\Log;

$logger = new Log();

$logger->debug("This is a debug message");

$logger->warn("This is a warning message");

$logger->info("This is an info message");

$logger->error("This is an error message");

$logger->critical("This is a critical message");

The logger class is set to create the log file in a JSON logstash format. This was personal taste since I use elasticsearch to consume all my logs.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate. *** PHPUnit Tests are to Follow ***

License

GPL-3.0

glogger's People

Watchers

James Cloos avatar

glogger's Issues

TODO: Check if folder is writable

We check if the log root folder exists and if the file exists, but we need a check that is the folder exists and is not writable to change the permissions so we can write the log file.

TODO: Create rootpath constant

Found some issues with the current method of finding path for LOG_ROOT pertaining to sub-directories. Add in a new rootpath constant as defined below:

define('ROOTPATH', dirname(__FILE__));
define("LOG_ROOT", ROOTPATH . "/logs/");

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.