edujugon/laravel-log 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

edujugon/laravel-log

最新稳定版本:1.2.0

Composer 安装命令:

composer require edujugon/laravel-log

包简介

Simple API to write logs for Laravel.

README 文档

README

Simple API to write logs for Laravel.

Installation

Type in console:
composer require edujugon/laravel-log

Laravel 5.5 or higher?

Then you don't have to either register or add the alias, this package uses Package Auto-Discovery's feature, and should be available as soon as you install it via Composer.

(Laravel < 5.5) Register the Log 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 days to be kept in server.

Syntax

Edujugon\Log\Log object days($days)

A value "0" means no day limit

withoutDateTime

withoutDateTime method excludes datetime from log line.

Syntax

Edujugon\Log\Log object withoutDateTime()

withoutLoggerDetails

withoutLoggerDetails method excludes logger details from log line.

Syntax

Edujugon\Log\Log object withoutLoggerDetails()

Exclude logger name and level

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();

统计信息

  • 总下载量: 10.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固