namespace AibisDream.Kit { internal readonly struct LogSettingsProfile { public readonly bool Enabled; public readonly bool EchoToConsole; public readonly LogLevel MinLevel; public readonly LogLevel ConsoleMinLevel; public readonly int QueueCapacity; public readonly int BatchSize; public readonly int FlushIntervalMilliseconds; public readonly int ShutdownDrainMilliseconds; public readonly long MaxFileBytes; public readonly long MaxTotalBytes; public readonly int MaxSessionFiles; public readonly bool IncludeWarningStackTrace; public LogSettingsProfile( bool enabled, bool echoToConsole, LogLevel minLevel, LogLevel consoleMinLevel, int queueCapacity, int batchSize, int flushIntervalMilliseconds, int shutdownDrainMilliseconds, long maxFileBytes, long maxTotalBytes, int maxSessionFiles, bool includeWarningStackTrace) { Enabled = enabled; EchoToConsole = echoToConsole; MinLevel = minLevel; ConsoleMinLevel = consoleMinLevel; QueueCapacity = queueCapacity; BatchSize = batchSize; FlushIntervalMilliseconds = flushIntervalMilliseconds; ShutdownDrainMilliseconds = shutdownDrainMilliseconds; MaxFileBytes = maxFileBytes; MaxTotalBytes = maxTotalBytes; MaxSessionFiles = maxSessionFiles; IncludeWarningStackTrace = includeWarningStackTrace; } } internal static class LogSettingsProfiles { private const long Megabyte = 1024L * 1024L; public static LogSettingsProfile Current { get { #if UNITY_EDITOR return Editor; #elif UNITY_ANDROID #if DEVELOPMENT_BUILD return AndroidDevelopment; #else return AndroidRelease; #endif #else #if DEVELOPMENT_BUILD return StandaloneDevelopment; #else return StandaloneRelease; #endif #endif } } private static LogSettingsProfile Editor => new LogSettingsProfile( enabled: false, echoToConsole: true, minLevel: LogLevel.Info, consoleMinLevel: LogLevel.Debug, queueCapacity: 2048, batchSize: 128, flushIntervalMilliseconds: 1000, shutdownDrainMilliseconds: 1000, maxFileBytes: 10L * Megabyte, maxTotalBytes: 100L * Megabyte, maxSessionFiles: 20, includeWarningStackTrace: false); private static LogSettingsProfile AndroidDevelopment => new LogSettingsProfile( enabled: true, echoToConsole: true, minLevel: LogLevel.Info, consoleMinLevel: LogLevel.Debug, queueCapacity: 1024, batchSize: 64, flushIntervalMilliseconds: 1500, shutdownDrainMilliseconds: 1000, maxFileBytes: 5L * Megabyte, maxTotalBytes: 30L * Megabyte, maxSessionFiles: 6, includeWarningStackTrace: false); private static LogSettingsProfile AndroidRelease => new LogSettingsProfile( enabled: true, echoToConsole: true, minLevel: LogLevel.Warning, consoleMinLevel: LogLevel.Warning, queueCapacity: 1024, batchSize: 64, flushIntervalMilliseconds: 1500, shutdownDrainMilliseconds: 1000, maxFileBytes: 5L * Megabyte, maxTotalBytes: 30L * Megabyte, maxSessionFiles: 6, includeWarningStackTrace: false); private static LogSettingsProfile StandaloneDevelopment => new LogSettingsProfile( enabled: true, echoToConsole: true, minLevel: LogLevel.Info, consoleMinLevel: LogLevel.Debug, queueCapacity: 2048, batchSize: 128, flushIntervalMilliseconds: 1000, shutdownDrainMilliseconds: 1000, maxFileBytes: 10L * Megabyte, maxTotalBytes: 100L * Megabyte, maxSessionFiles: 20, includeWarningStackTrace: false); private static LogSettingsProfile StandaloneRelease => new LogSettingsProfile( enabled: true, echoToConsole: true, minLevel: LogLevel.Info, consoleMinLevel: LogLevel.Info, queueCapacity: 2048, batchSize: 128, flushIntervalMilliseconds: 1000, shutdownDrainMilliseconds: 1000, maxFileBytes: 10L * Megabyte, maxTotalBytes: 100L * Megabyte, maxSessionFiles: 20, includeWarningStackTrace: false); } }