Coder Social home page Coder Social logo

laravel-log's Introduction

Laravel Log Package

Simple API to write logs for Laravel.

Installation

Type in console:
composer require edujugon/laravel-log
Register the GoogleAds service by adding it to the providers array.
'providers' => array(
        ...
        Edujugon\Log\Providers\LogServiceProvider::class
    )
Publish the package's configuration file to the application's own config directory.
php artisan vendor:publish --provider="Edujugon\Log\Providers\LogServiceProvider" --tag="config"

The above command will generate a new file under your laravel app config folder called log.php

Configuration

Update the log.php file with your data.

API List

path

path method sets the path where create / storage the log file.

Syntax

Edujugon\Log\Log object path($path)

level

level method sets the logging level.

Available levels: emergency, alert, critical, error, warning, notice, info and debug.

Syntax

Edujugon\Log\Log object level($level)

title

title method sets the title or main message to be written.

Syntax

Edujugon\Log\Log object title($title)

line

line method sets a line below the title.

Notice that you can call this method as many time as lines you need to be written.

Syntax

Edujugon\Log\Log object line($line)

logname

name method sets the logger name.

By default this name is "my-logger"

Syntax

Edujugon\Log\Log object name($loggerName)

fileName

fileName method sets the file name.

Remember to put the name without any extension.

Syntax

Edujugon\Log\Log object fileName($name)

days

days method sets amount of files to be kept in server.

Syntax

Edujugon\Log\Log object days($days)

write

write method writes in log file.

Syntax

boolean write()

Usage samples

$log = new Log();
$log->fileName('my-personal-log')
    ->title('Stored new record')
    ->line('the record id is 3')
    ->line('Stored by John')
    ->line('This is antoher line')
    ->days(3)
    ->write();

Also can do it by its Facade:

Log::fileName('my-personal-log')
    ->title('Stored new record')
    ->line('the record id is 3')
    ->line('Stored by John')
    ->line('This is antoher line')
    ->write();

laravel-log's People

Contributors

edujugon avatar

Watchers

Marcos avatar James Cloos avatar Juan Serrats avatar  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.