Can you provide a concrete example of how to implement a logging system in PHP using object-oriented programming principles, considering the need for global and user-specific logs based on a debug level variable?

To implement a logging system in PHP using object-oriented programming principles with global and user-specific logs based on a debug level variable, we can create a Logger class that handles the logging functionality. We can then instantiate separate Logger objects for global and user-specific logs, each with its own debug level setting.

<?php

class Logger {
    private $debugLevel;

    public function __construct($debugLevel) {
        $this->debugLevel = $debugLevel;
    }

    public function log($message, $level) {
        if ($level <= $this->debugLevel) {
            echo "[" . date('Y-m-d H:i:s') . "] [$level] $message\n";
        }
    }
}

// Global log with debug level 1
$globalLogger = new Logger(1);
$globalLogger->log("This is a global log message", 1);

// User-specific log with debug level 2
$userLogger = new Logger(2);
$userLogger->log("This is a user-specific log message", 2);

?>