mirror of
https://github.com/friendica/friendica
synced 2024-12-23 12:40:17 +00:00
Bugfixing Monolog
- Default Loglevel for logs set to 'info' - Default config level is set to 'notice' - using 'notice' for auth-failures - Bugfixing wrong usage of legacy 'log()'
This commit is contained in:
parent
da7706ce61
commit
aa15c0e094
2 changed files with 13 additions and 11 deletions
|
@ -84,7 +84,7 @@ class Logger extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_int($loglevel)) {
|
if (is_int($loglevel)) {
|
||||||
$loglevel = self::mapLegacyConfigDebugLevel($loglevel);
|
$loglevel = self::mapLegacyDebugLevel($loglevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggerFactory::addStreamHandler($logger, $logfile, $loglevel);
|
LoggerFactory::addStreamHandler($logger, $logfile, $loglevel);
|
||||||
|
@ -111,7 +111,7 @@ class Logger extends BaseObject
|
||||||
*
|
*
|
||||||
* @return string the PSR-3 compliant level
|
* @return string the PSR-3 compliant level
|
||||||
*/
|
*/
|
||||||
private static function mapLegacyConfigDebugLevel($level)
|
private static function mapLegacyDebugLevel($level)
|
||||||
{
|
{
|
||||||
switch ($level) {
|
switch ($level) {
|
||||||
// legacy WARNING
|
// legacy WARNING
|
||||||
|
@ -323,19 +323,21 @@ class Logger extends BaseObject
|
||||||
* @brief Logs the given message at the given log level
|
* @brief Logs the given message at the given log level
|
||||||
*
|
*
|
||||||
* @param string $msg
|
* @param string $msg
|
||||||
* @param string $level
|
* @param int $level
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @deprecated since 2019.03 Use Logger::debug() Logger::info() , ... instead
|
* @deprecated since 2019.03 Use Logger::debug() Logger::info() , ... instead
|
||||||
*/
|
*/
|
||||||
public static function log($msg, $level = LogLevel::NOTICE)
|
public static function log($msg, $level = 3)
|
||||||
{
|
{
|
||||||
if (!isset(self::$logger)) {
|
if (!isset(self::$logger)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$loglevel = self::mapLegacyDebugLevel($level);
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
self::$logger->log($level, $msg);
|
self::$logger->log($loglevel, $msg);
|
||||||
self::getApp()->saveTimestamp($stamp1, "file");
|
self::getApp()->saveTimestamp($stamp1, "file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ class Login extends BaseModule
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Logger::log('authenticate: failed login attempt: ' . Strings::escapeTags($username) . ' from IP ' . $_SERVER['REMOTE_ADDR']);
|
Logger::notice('authenticate: failed login attempt', ['username' => Strings::escapeTags($username), 'ip' => $_SERVER['REMOTE_ADDR']]);
|
||||||
info('Login failed. Please check your credentials.' . EOL);
|
info('Login failed. Please check your credentials.' . EOL);
|
||||||
$a->internalRedirect();
|
$a->internalRedirect();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue