using System;

namespace Volpe.Cafe.Logging
{
    /// <summary>
    /// Provides support for creating <see cref="ILogger"/> objects.
    /// </summary>
    [Serializable]
    public static class LoggerFactory
    {
        /// <summary>
        /// Returns a default <see cref="ILogger"/> using the specified paths for standard and debugging log files, or
        /// an <see cref="EmptyLogger"/> if <paramref name="logLevel"/> is <see cref="LogLevel.Disabled"/>.
        /// </summary>
        /// <inheritdoc cref="Logger(LogLevel, string, string)" path="/param"/>
        /// <inheritdoc cref="Logger(LogLevel, string, string)" path="/remarks"/>
        public static ILogger CreateLogger(LogLevel logLevel, string logPath, string debugLogPath)
        {
            return logLevel.IsDisabled()
                ? GetEmptyLogger()
                : GetDefaultLogger(logLevel, logPath, debugLogPath);
        }

        /// <summary>
        /// Returns a default <see cref="ILogger"/> using the specified paths for standard and debugging log files.
        /// </summary>
        /// <inheritdoc cref="Logger(LogLevel, string, string)" path="/param"/>
        /// <inheritdoc cref="Logger(LogLevel, string, string)" path="/remarks"/>
        public static ILogger GetDefaultLogger(LogLevel logLevel, string logPath, string debugLogPath)
        {
            return new Logger(logLevel, logPath, debugLogPath);
        }

        /// <summary>
        /// Returns an <see cref="EmptyLogger"/> that suppresses all logging capability.
        /// </summary>
        public static ILogger GetEmptyLogger()
        {
            return new EmptyLogger();
        }

    }
}
