log

  • 所有者: php-fig/log
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

PSR Log

This repository holds all interfaces/classes/traits related to
PSR-3.

Note that this is not a logger of its own. It is merely an interface that
describes a logger. See the specification for more details.

Installation

composer require psr/log

Usage

If you need a logger, you can use the interface like this:

<?php

use Psr\Log\LoggerInterface;

class Foo
{
    private $logger;

    public function __construct(LoggerInterface $logger = null)
    {
        $this->logger = $logger;
    }

    public function doSomething()
    {
        if ($this->logger) {
            $this->logger->info('Doing work');
        }
           
        try {
            $this->doSomethingElse();
        } catch (Exception $exception) {
            $this->logger->error('Oh no!', array('exception' => $exception));
        }

        // do something useful
    }
}

You can then pick one of the implementations of the interface to get a logger.

If you want to implement the interface, you can require this package and
implement Psr\Log\LoggerInterface in your code. Please read the
specification text
for details.

主要指标

概览
名称与所有者php-fig/log
主编程语言PHP
编程语言PHP (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2012-11-30 09:49:24
推送于2024-09-11 13:21:12
最后一次提交2024-09-11 15:17:53
发布数12
最新版本名称3.0.2 (发布于 )
第一版名称1.0.0 (发布于 )
用户参与
星数10.4k
关注者数63
派生数182
提交数97
已启用问题?
问题数0
打开的问题数0
拉请求数36
打开的拉请求数1
关闭的拉请求数34
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?