コード例 #1
0
        public CurrentFileReader(FileLogger fileLogger)
        {
            _fileLogger = fileLogger;

            lock (_fileLogger.SyncRoot)
            {
                var fileConnection = _fileLogger.FileConnection;

                if (fileConnection != null)
                {
                    Date = fileConnection.CreationDate;
                }
            }
        }
コード例 #2
0
        public FileLogTraceListener(string initializeData)
        {
            Verify.ArgumentNotNullOrEmpty(initializeData, nameof(initializeData));

            string[] parts = initializeData.Split(new[] {','});
            Verify.ArgumentCondition(parts.Length == 2, "initializeData", "Wrong configuration parameters");

            if(LoggerInstance == null)
            {
                string logFolderPath = parts[0];
                bool flushAfterEveryLine;
                if (!bool.TryParse(parts[1], out flushAfterEveryLine))
                {
                    throw new ArgumentException(initializeData, nameof(initializeData));
                }

                // Setting public property, so it can be used by a webservice
                LoggerInstance = new FileLogger(logFolderPath, flushAfterEveryLine);
            }
        }