Skip to content

Added compatibility with psr-3 (a.k.a. psr/log) #62

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
}
],
"require": {
"php": ">=5.3.0"
"php": ">=5.3.0",
"psr/log": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "~4.3",
Expand Down
47 changes: 47 additions & 0 deletions src/FluentLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
namespace Fluent\Logger;

use Psr\Log\LogLevel;

/**
* Fluent Logger
*
Expand Down Expand Up @@ -516,4 +518,49 @@ public function getOption($key, $default = null)

return $result;
}

public function emergency($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::EMERGENCY), $context));
}

public function alert($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::ALERT), $context));
}

public function critical($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::CRITICAL), $context));
}

public function error($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::ERROR), $context));
}

public function warning($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::WARNING), $context));
}

public function notice($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::NOTICE), $context));
}

public function info($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::INFO), $context));
}

public function debug($message, array $context = array())
{
return $this->post($message, array_merge(array('level' => LogLevel::DEBUG), $context));
}

public function log($level, $message, array $context = array())
{
return $this->post($message, array_merge(array('level' => $level), $context));
}
}
2 changes: 1 addition & 1 deletion src/LoggerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
namespace Fluent\Logger;

interface LoggerInterface
interface LoggerInterface extends \Psr\Log\LoggerInterface
{
/**
* @abstract
Expand Down