Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

log

> 编程语言
Open source

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 mere…

10.4K stars0 likes1 views
WebsiteGitHub

About

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 mere…

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

bash
composer require psr/log

Usage

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

php
<?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.

Issues· 7 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPpsr-3

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 2, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言