// Copyright (c) 2025-2026 GeWuYou // SPDX-License-Identifier: Apache-2.0 using System; using GFramework.Core.Abstractions.Logging; namespace GFramework.Godot.Logging; /// /// Creates Godot platform logger instances. /// public sealed class GodotLoggerFactory : ILoggerFactory { private readonly GodotLoggerOptions? _options; /// /// Initializes a factory that preserves the historical fixed-format logger behavior. /// public GodotLoggerFactory() { } /// /// Initializes a factory with Godot-specific formatting options. /// /// The logger options. public GodotLoggerFactory(GodotLoggerOptions options) { _options = options ?? throw new ArgumentNullException(nameof(options)); } /// /// Gets a logger with the specified name. /// /// The logger name. /// The minimum enabled level. /// A Godot logger instance. public ILogger GetLogger(string name, LogLevel minLevel = LogLevel.Info) { ArgumentNullException.ThrowIfNull(name); if (_options == null) { return new GodotLogger(name, minLevel); } return new GodotLogger(name, _options.WithMinimumLevelFloor(minLevel)); } }