Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger log function bug #15214

Closed
gpkappos opened this issue Nov 20, 2020 · 3 comments · Fixed by #15235
Closed

Logger log function bug #15214

gpkappos opened this issue Nov 20, 2020 · 3 comments · Fixed by #15235
Labels
4.1.1 The issues we want to solve in the 4.1.1 release bug A bug report status: low Low

Comments

@gpkappos
Copy link

The Logger->log function does not use the intLevel that calculates.

As a result calling log with the PSR-3 LogLevels does not work as expected.

    public function log(level, message, array context = []) -> void
    {
        var intLevel;

        let intLevel = this->getLevelNumber(level);

        this->addMessage(level, (string) message, context);
    }
@Jeckerson
Copy link
Member

Hello. Please provide code example.

@Jeckerson Jeckerson added the need script to reproduce Script is required to reproduce the issue label Nov 20, 2020
@gpkappos
Copy link
Author

Hello, here is a demonstration of the problem

<?php
use Phalcon\Logger;
use Phalcon\Logger\Adapter\Stream;
use Phalcon\Logger\Formatter\Line;

$adapter = new Stream('php://stdout');
$adapter->setFormatter(new Line('[%date%][%type%] %message%', 'Y-m-d H:i:s'));
$logger = new Logger('messages', [$adapter]);

$logger->log(Logger::INFO, 'info message');

$logger->log(\Psr\Log\LogLevel::INFO, 'info message using psr log level');

my result is
[2020-11-20 13:12:04][info] info message
[2020-11-20 13:12:04][emergency] info message using psr log level

@Jeckerson Jeckerson added 4.1.1 The issues we want to solve in the 4.1.1 release bug A bug report status: low Low and removed need script to reproduce Script is required to reproduce the issue labels Nov 20, 2020
@niden niden mentioned this issue Dec 10, 2020
5 tasks
@niden niden linked a pull request Dec 10, 2020 that will close this issue
5 tasks
@niden
Copy link
Member

niden commented Dec 10, 2020

Resolved. Thank you for reporting this @gpkappos

@niden niden closed this as completed Dec 10, 2020
@niden niden moved this to Released in Phalcon v5 Aug 25, 2022
@niden niden added this to Phalcon v5 Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.1.1 The issues we want to solve in the 4.1.1 release bug A bug report status: low Low
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants