Exemple #1
0
        private static ConsoleLogWriter SetupLogging()
        {
            ConsoleLogWriter consoleWriter = new ConsoleLogWriter
            {
                LogLevel = BeatSyncLib.Logging.LogLevel.Info
            };

            LogManager.AddLogWriter(consoleWriter);
            BeatSyncLib.Logger.log = new BeatSyncLogger("BeatSyncLib");
            SongFeedReaderLogger feedReaderLogger = new SongFeedReaderLogger("SongFeedReader");

            SongFeedReaders.Logging.LoggingController.DefaultLogger = feedReaderLogger;
            try
            {
                string logDirectory = LogDirectory ?? Paths.LogDirectory;
                string logFilePath  = Path.Combine(logDirectory, "log.txt");
                Directory.CreateDirectory(logDirectory);
                LogManager.AddLogWriter(new FileLogWriter(logFilePath));
            }
            catch (Exception ex)
            {
                Logger.log.Error($"Error creating FileLogWriter: {ex.Message}");
            }
            return(consoleWriter);
        }