ArchiSteamFarm.Logging.InitCoreLoggers C# (CSharp) Метод

InitCoreLoggers() статический приватный Метод

static private InitCoreLoggers ( ) : void
Результат void
        internal static void InitCoreLoggers()
        {
            if (LogManager.Configuration == null) {
                LogManager.Configuration = new LoggingConfiguration();
            } else {
                // User provided custom NLog config, but we still need to define our own logger
                IsUsingCustomConfiguration = true;
                if (LogManager.Configuration.AllTargets.Any(target => target is MessageBoxTarget)) {
                    return;
                }
            }

            MessageBoxTarget messageBoxTarget = new MessageBoxTarget {
                Name = "MessageBox",
                Layout = GeneralLayout
            };

            LogManager.Configuration.AddTarget(messageBoxTarget);
            LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Fatal, messageBoxTarget));
            LogManager.ReconfigExistingLoggers();
        }

Usage Example

Пример #1
0
        private static void InitCore(IReadOnlyCollection <string> args)
        {
            Directory.SetCurrentDirectory(SharedInfo.HomeDirectory);

            // Allow loading configs from source tree if it's a debug build
            if (Debugging.IsDebugBuild)
            {
                // Common structure is bin/(x64/)Debug/ArchiSteamFarm.exe, so we allow up to 4 directories up
                for (byte i = 0; i < 4; i++)
                {
                    Directory.SetCurrentDirectory("..");

                    if (Directory.Exists(SharedInfo.ConfigDirectory))
                    {
                        break;
                    }
                }

                // If config directory doesn't exist after our adjustment, abort all of that
                if (!Directory.Exists(SharedInfo.ConfigDirectory))
                {
                    Directory.SetCurrentDirectory(SharedInfo.HomeDirectory);
                }
            }

            // Parse pre-init args
            if (args != null)
            {
                ParsePreInitArgs(args);
            }

            Logging.InitCoreLoggers();
        }
All Usage Examples Of ArchiSteamFarm.Logging::InitCoreLoggers