<?php

namespace ARCHM\Helpers;

class Logger {
	// phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid, PHPCompatibility.FunctionDeclarations.NewReturnTypeDeclarations.voidFound
	public static function logError( $message ): void {
		if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
			// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
			error_log("[Error] $message");
		}
	}

	// phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid, PHPCompatibility.FunctionDeclarations.NewReturnTypeDeclarations.voidFound
	public static function logMessage( $message ): void {
		if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
			if ( is_array($message) || is_object($message) ) {
				// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
				$message = print_r($message, true);
			}
			// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
			error_log("[Info] $message");
		}
	}
}
