log(level, message) {
		const levels = ["error", "warn", "info", "debug"];
		if (levels.indexOf(level) <= levels.indexOf(this.#logLevel)) {
			let logEntry;

			// Check if the message is an instance of Error
			if (message instanceof Error) {
				logEntry = `[${new Date().toISOString()}] [${level.toUpperCase()}] ${message.name}: ${message.message}\nStack trace: ${message.stack}`;
			} else {
				logEntry = `[${new Date().toISOString()}] [${level.toUpperCase()}] ${message}`;
			}
			// LRU Mechanism for efficient log buffer management
			if (this.#logBuffer.size >= this.#maxBufferSize) {
				// Remove oldest entry
				const oldestKey = this.#logBuffer.keys().next().value;
				this.#logBuffer.delete(oldestKey);
			}
			this.#logBuffer.set(Date.now(), logEntry); // Using timestamp as key
		}
	}
Logs a message with the specified log level.
@param {'error' | 'warn' | 'info' | 'debug'} level - The log level.
@param {string} message - The message to be logged.