mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 01:10:42 +08:00
[Legacy] Update install logger format
This commit is contained in:
parent
86182c7983
commit
c8cca0ac99
2 changed files with 44 additions and 4 deletions
|
@ -81,7 +81,7 @@ class SugarLogger implements LoggerTemplate
|
|||
"%m_%Y" => "Month_Year",
|
||||
"%d_%m" => "Day_Month",
|
||||
"%m_%d_%y" => "Month_Day_Year",
|
||||
);
|
||||
);
|
||||
|
||||
/**
|
||||
* Let's us know if we've initialized the logger file
|
||||
|
@ -246,14 +246,14 @@ class SugarLogger implements LoggerTemplate
|
|||
IntlDateFormatter::MEDIUM,
|
||||
$timezone,
|
||||
IntlDateFormatter::GREGORIAN,
|
||||
"EEE MMM d yyyy 'at' HH:mm:ss",
|
||||
$this->getDateFormatString(),
|
||||
);
|
||||
|
||||
//write out to the file including the time in the dateFormat the process id , the user id , and the log level as well as the message
|
||||
fwrite(
|
||||
$this->fp,
|
||||
$format->format(time()) . ' [' . getmypid() . '][' . $userID . '][' . strtoupper($level) . '] ' . $message . "\n"
|
||||
);
|
||||
$this->formatLog($format, $userID, $level, $message)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,4 +319,24 @@ class SugarLogger implements LoggerTemplate
|
|||
$this->fp = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getDateFormatString(): string
|
||||
{
|
||||
return "EEE MMM d yyyy 'at' HH:mm:ss";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IntlDateFormatter $format
|
||||
* @param string $userID
|
||||
* @param $level
|
||||
* @param mixed $message
|
||||
* @return string
|
||||
*/
|
||||
protected function formatLog(IntlDateFormatter $format, string $userID, $level, mixed $message): string
|
||||
{
|
||||
return $format->format(time()) . ' [' . getmypid() . '][' . $userID . '][' . strtoupper($level) . '] ' . $message . "\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,4 +53,24 @@ class InstallLogger extends SugarLogger
|
|||
$this->_doInitialization();
|
||||
InstallLoggerManager::setLogger('default', 'InstallLogger');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getDateFormatString(): string
|
||||
{
|
||||
return "[YYYY-MM-DD HH:mm:ss]";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IntlDateFormatter $format
|
||||
* @param string $userID
|
||||
* @param $level
|
||||
* @param mixed $message
|
||||
* @return string
|
||||
*/
|
||||
protected function formatLog(IntlDateFormatter $format, string $userID, $level, mixed $message): string
|
||||
{
|
||||
return $format->format(time()) . ' install.' . strtoupper($level) . ': ' . $message . "\n";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue