public static RollingFileLogger AddDefaultWriterPipe(this RollingFileLogger source)
        {
            source.Pipes.Add(
                new RollingFileWriterPipe()
                );

            return(source);
        }
        public static RollingFileLogger AddPipes(
            this RollingFileLogger source,
            params Action <RollingFileContext, Action <RollingFileContext> >[] collection
            )
        {
            source.Pipes.AddRange(collection);

            return(source);
        }
        public static RollingFileLogger UsePipes(
            this RollingFileLogger source, params
            IPipe <RollingFileContext>[] collection
            )
        {
            source.Pipes.Clear();
            source.Pipes.AddRange(collection);

            return(source);
        }
        public static RollingFileLogger AddBytesLimitRollerPipe(
            this RollingFileLogger source,
            IRollingFileAction action = null,
            long bytesLimit           = 1024 * 1024 * 1024
            )
        {
            action = action ?? new RollingFileDisableLoggerAction();

            source.Pipes.Add(
                new RollingFileBytesLimitTrigger(action, bytesLimit)
                );

            return(source);
        }
        public static RollingFileLogger AddDailyRollerPipe(
            this RollingFileLogger source,
            IRollingFileAction[] actions = null,
            bool instantNext             = true
            )
        {
            actions = actions ?? new IRollingFileAction[] {
                new RollingFileCreateFileAction(append: true, tryUseTodayLastFile: true),
                new RollingFileCleanerAction(expirationTimeSpan: TimeSpan.FromDays(30))
            };

            source.Pipes.Add(
                new RollingFileDailyTrigger(actions, instantNext)
                );

            return(source);
        }
        //7
        public static BackgroundLogger BackgroundRollingFileLogger(
            this LoggingWizardCharms charms,
            IRollingFileProvider fileProvider,
            ILogRecordVerifier recordVerifier,
            IStringLogSerializer serializer = null,
            Encoding encoding = null,
            PipeCollection <RollingFileContext> pipes = null
            )
        {
            var baseLogger = new RollingFileLogger(fileProvider)
            {
                RecordVerifier = recordVerifier
            };

            baseLogger.Serializer = serializer ?? baseLogger.Serializer;
            baseLogger.Encoding   = encoding ?? baseLogger.Encoding;
            baseLogger.Pipes      = pipes ?? baseLogger.Pipes;

            return(charms.BackgroundLogger(baseLogger));
        }
Esempio n. 7
0
        //7
        public static RollingFileLogger RollingFileLogger(
            this LoggingWizardCharms charms,
            IRollingFileProvider fileProvider,
            ILogRecordVerifier recordVerifier,
            IStringLogSerializer serializer = null,
            Encoding encoding = null,
            PipeCollection <RollingFileContext> pipes = null
            )
        {
            var logger = new RollingFileLogger(fileProvider)
            {
                RecordVerifier = recordVerifier
            };

            logger.Serializer = serializer ?? logger.Serializer;
            logger.Encoding   = encoding ?? logger.Encoding;
            logger.Pipes      = pipes ?? logger.Pipes;

            return(logger);
        }
        public static RollingFileLogger ClearPipes(this RollingFileLogger source)
        {
            source.Pipes.Clear();

            return(source);
        }