/// <summary>
        /// Initializes logger with protection
        /// </summary>
        protected virtual void InitializeLogger()
        {
            var logger = new ProtectedLoggerConfiguration
            {
                DateFormat         = "yyy-MM-dd",
                DateTimeFormat     = "HH:mm:ss",
                LogCleanupTemplate = "ppp-games-*-*-*.log",
                LogDirectory       = "Logs",
                LogTemplate        = "ppp-games-{0}.log",
                MessagesInBuffer   = 10
            };

            protectedLogger = ServiceLocator.Current.GetInstance <IProtectedLogger>();
            protectedLogger.Initialize(logger);
            protectedLogger.CleanLogs();
            protectedLogger.StartLogging();
        }
Exemplo n.º 2
0
        public LoggerRoot(string outputFile, bool directLogToFile, string location, string starttext)
        {
            m_outputfile      = outputFile;
            m_directLogToFile = directLogToFile && !String.IsNullOrEmpty(outputFile);

            m_oldest = new LogEntry(
                UniqueInteger.Get(),
                DateTime.Now,
                System.Threading.Thread.CurrentThread.ManagedThreadId,
                location,
                starttext);
            m_newest     = m_oldest;
            m_rootLogger = new Logger(this, m_newest).GetProtectedLogger();     // Cannot be disposed by accident, then.

            if (m_sink != null)
            {
                m_sink.Add(m_newest);
            }
        }