Skip to content
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
36 changes: 18 additions & 18 deletions classes/logging/loggerbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function setlevelrange() {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function emergency($message, array $context = []) {
public function emergency($message, array $context = []): void {
// Only log if range is light or greater (Emergency|Alert|Critical).
if ($this->logrange >= constants::RANGE_LIGHT) {
$this->log(LogLevel::EMERGENCY, $message, $context);
Expand All @@ -72,9 +72,9 @@ public function emergency($message, array $context = []) {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function alert($message, array $context = []) {
public function alert($message, array $context = []): void {
// Only log if range is light or greater (Emergency|Alert|Critical).
if ($this->logrange >= constants::RANGE_LIGHT) {
$this->log(LogLevel::ALERT, $message, $context);
Expand All @@ -88,9 +88,9 @@ public function alert($message, array $context = []) {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function critical($message, array $context = []) {
public function critical($message, array $context = []): void {
// Only log if range is light or greater (Emergency|Alert|Critical).
if ($this->logrange >= constants::RANGE_LIGHT) {
$this->log(LogLevel::CRITICAL, $message, $context);
Expand All @@ -103,9 +103,9 @@ public function critical($message, array $context = []) {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function error($message, array $context = []) {
public function error($message, array $context = []): void {
// Only log if range is medium or greater (Emergency|Alert|Critical|Error|Warning).
if ($this->logrange >= constants::RANGE_MEDIUM) {
$this->log(LogLevel::ERROR, $message, $context);
Expand All @@ -120,9 +120,9 @@ public function error($message, array $context = []) {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function warning($message, array $context = []) {
public function warning($message, array $context = []): void {
// Only log if range is medium (Emergency|Alert|Critical|Error|Warning).
if ($this->logrange >= constants::RANGE_MEDIUM) {
$this->log(LogLevel::WARNING, $message, $context);
Expand All @@ -134,9 +134,9 @@ public function warning($message, array $context = []) {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function notice($message, array $context = []) {
public function notice($message, array $context = []): void{
// Only log if range is all - every possible type of log.
if ($this->logrange >= constants::RANGE_ALL) {
$this->log(LogLevel::NOTICE, $message, $context);
Expand All @@ -150,9 +150,9 @@ public function notice($message, array $context = []) {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function info($message, array $context = []) {
public function info($message, array $context = []): void {
// Only log if range is all - every possible type of log.
if ($this->logrange >= constants::RANGE_ALL) {
$this->log(LogLevel::INFO, $message, $context);
Expand All @@ -164,9 +164,9 @@ public function info($message, array $context = []) {
*
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function debug($message, array $context = []) {
public function debug($message, array $context = []): void {
// Only log if range is all - every possible type of log.
if ($this->logrange >= constants::RANGE_ALL) {
$this->log(LogLevel::DEBUG, $message, $context);
Expand All @@ -179,8 +179,8 @@ public function debug($message, array $context = []) {
* @param mixed $level
* @param string $message
* @param array $context
* @return null
* @return void
*/
abstract public function log($level, $message, array $context = []);
abstract public function log($level, $message, array $context = []): void;

}
6 changes: 3 additions & 3 deletions classes/logging/loggerdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class loggerdb extends loggerbase {
* @param mixed $level
* @param string $message
* @param array $context
* @return null
* @return void
*/
public function log($level, $message, array $context = []) {
public function log($level, $message, array $context = []): void {
global $DB;
$data = '';
foreach ($context as $key => $val) {
Expand All @@ -52,6 +52,6 @@ public function log($level, $message, array $context = []) {

$record = (object) ['time' => time(), 'level' => $level, 'message' => $message, 'data' => $data];

return $DB->insert_record('collaborate_log', $record);
$DB->insert_record('collaborate_log', $record);
}
}