当前位置: 首页>>代码示例>>C#>>正文


C# ILogFormatter类代码示例

本文整理汇总了C#中ILogFormatter的典型用法代码示例。如果您正苦于以下问题:C# ILogFormatter类的具体用法?C# ILogFormatter怎么用?C# ILogFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ILogFormatter类属于命名空间,在下文中一共展示了ILogFormatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetLogFormatter

 public static void SetLogFormatter(LogEntry logEntry, ILogFormatter logFormatter)
 {
     if (logEntry != null)
     {
         _logFormatter = logFormatter;
     }
 }
开发者ID:SaintLoong,项目名称:CommonLibrary,代码行数:7,代码来源:LogEntryFormatter.cs

示例2: RollingFlatFileTraceListener

        /// <summary>
        /// Initializes a new instance of the <see cref="RollingFlatFileTraceListener"/> class.
        /// </summary>
        /// <param name="fileName">The filename where the entries will be logged.</param>
        /// <param name="header">The header to add before logging an entry.</param>
        /// <param name="footer">The footer to add after logging an entry.</param>
        /// <param name="formatter">The formatter.</param>
        /// <param name="rollSizeKB">The maxium file size (KB) before rolling.</param>
        /// <param name="timeStampPattern">The date format that will be appended to the new roll file.</param>
        /// <param name="rollFileExistsBehavior">Expected behavior that will be used when the roll file has to be created.</param>
        /// <param name="rollInterval">The time interval that makes the file rolles.</param>
        /// <param name="maxArchivedFiles">The maximum number of archived files to keep.</param>
        public RollingFlatFileTraceListener(string fileName,
                                            string header = DefaultSeparator,
                                            string footer = DefaultSeparator,
                                            ILogFormatter formatter = null,
                                            int rollSizeKB = 0,
                                            string timeStampPattern = "yyyy-MM-dd",
                                            RollFileExistsBehavior rollFileExistsBehavior = RollFileExistsBehavior.Overwrite,
                                            RollInterval rollInterval = RollInterval.None,
                                            int maxArchivedFiles = 0)
            : base(fileName, header, footer, formatter)
        {
            Guard.ArgumentNotNullOrEmpty(fileName, "fileName");

            this.rollSizeInBytes = rollSizeKB * 1024;
            this.timeStampPattern = timeStampPattern;
            this.rollFileExistsBehavior = rollFileExistsBehavior;
            this.rollInterval = rollInterval;
            this.maxArchivedFiles = maxArchivedFiles;

            this.rollingHelper = new StreamWriterRollingHelper(this);

            if (rollInterval == RollInterval.Midnight)
            {
                var now = this.rollingHelper.DateTimeProvider.CurrentDateTime;
                var midnight = now.AddDays(1).Date;

                this.timer = new Timer((o) => this.rollingHelper.RollIfNecessary(), null, midnight.Subtract(now), TimeSpan.FromDays(1));
            }
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:41,代码来源:RollingFlatFileTraceListener.cs

示例3: EmailMessage

 /// <summary>
 /// Initializes a <see cref="EmailMessage"/> with the raw data to create and email, a message, and the formatter 
 /// </summary>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="message">Represents the message to send via email.</param>
 /// <param name="formatter">The Formatter <see cref="ILogFormatter"/> which determines how the 
 /// email message should be formatted</param>
 public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, string message, ILogFormatter formatter)
 {
     this.configurationData = new EmailTraceListenerData(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, string.Empty);
     this.logEntry = new LogEntry();
     logEntry.Message = message;
     this.formatter = formatter;
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:19,代码来源:EmailMessage.cs

示例4: WaveDrawer

 public WaveDrawer(string logPath, Size chartSize, Size chartGridSize, ILogFormatter logFormatter)
 {
     this.logPath = logPath;
     this.chartSize = chartSize;
     this.logFormatter = logFormatter;
     this.chartGridSize = chartGridSize;
 }
开发者ID:zhangsichu,项目名称:ActionPerMinute,代码行数:7,代码来源:WaveDrawer.cs

示例5: EmailLogProvider

 public EmailLogProvider(
     DeliveryMethod deliveryMethod = null,
     ILogFormatter logFormatter = null)
     : base(logFormatter ?? DefaultLogFormatter)
 {
     _deliveryMethod = deliveryMethod ?? DefaultDeliveryMethod;
 }
开发者ID:Orthak,项目名称:Rock.Logging,代码行数:7,代码来源:EmailLogProvider.cs

示例6: MsmqTraceListener

 /// <summary>
 /// Initializes a new instance of <see cref="MsmqTraceListener"/>.
 /// </summary>
 /// <param name="name">The name of the new instance.</param>
 /// <param name="queuePath">The path to the queue to deliver to.</param>
 /// <param name="formatter">The formatter to use.</param>
 /// <param name="messagePriority">The priority for the messages to send.</param>
 /// <param name="recoverable">The recoverable flag for the messages to send.</param>
 /// <param name="timeToReachQueue">The timeToReachQueue for the messages to send.</param>
 /// <param name="timeToBeReceived">The timeToBeReceived for the messages to send.</param>
 /// <param name="useAuthentication">The useAuthentication flag for the messages to send.</param>
 /// <param name="useDeadLetterQueue">The useDeadLetterQueue flag for the messages to send.</param>
 /// <param name="useEncryption">The useEncryption flag for the messages to send.</param>
 /// <param name="transactionType">The <see cref="MessageQueueTransactionType"/> for the message to send.</param>
 /// <param name="msmqInterfaceFactory">The factory to create the msmq interfaces.</param>
 public MsmqTraceListener(string name,
                          string queuePath,
                          ILogFormatter formatter,
                          MessagePriority messagePriority,
                          bool recoverable,
                          TimeSpan timeToReachQueue,
                          TimeSpan timeToBeReceived,
                          bool useAuthentication,
                          bool useDeadLetterQueue,
                          bool useEncryption,
                          MessageQueueTransactionType transactionType,
                          IMsmqSendInterfaceFactory msmqInterfaceFactory)
     : base(formatter)
 {
     this.queuePath = queuePath;
     this.messagePriority = messagePriority;
     this.recoverable = recoverable;
     this.timeToReachQueue = timeToReachQueue;
     this.timeToBeReceived = timeToBeReceived;
     this.useAuthentication = useAuthentication;
     this.useDeadLetterQueue = useDeadLetterQueue;
     this.useEncryption = useEncryption;
     this.transactionType = transactionType;
     this.msmqInterfaceFactory = msmqInterfaceFactory;
 }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:40,代码来源:MsmqTraceListener.cs

示例7: FormattedDatabaseTraceListener

        /// <summary>
        /// Initializes a new instance of <see cref="FormattedDatabaseTraceListener"/>.
        /// </summary>
        /// <param name="database">The database for writing the log.</param>
        /// <param name="writeLogStoredProcName">The stored procedure name for writing the log.</param>
        /// <param name="addCategoryStoredProcName">The stored procedure name for adding a category for this log.</param>
        /// <param name="formatter">The formatter.</param>        
        public FormattedDatabaseTraceListener(Data.Database database, string writeLogStoredProcName, string addCategoryStoredProcName, ILogFormatter formatter
			)
            : base(formatter)
        {
            this.writeLogStoredProcName = writeLogStoredProcName;
            this.addCategoryStoredProcName = addCategoryStoredProcName;
            this.database = database;
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:15,代码来源:FormattedDatabaseTraceListener.cs

示例8: DefaultOutputHandler

        public DefaultOutputHandler(ILogFilters filters, ILogFormatter formatter)
        {
            if (filters == null)
                throw new ArgumentNullException("filters", "A valid set of log filters is required for proper operation.");

            this.Filters = filters;
            this.Formatter = formatter;
        }
开发者ID:mdabbagh88,项目名称:YALF,代码行数:8,代码来源:DefaultOutputHandler.cs

示例9: AddLogWriter

 public static void AddLogWriter(ILogWriter logWriter, ILogFormatter logFormatter)
 {
     logWriters.Add(new LogWriterInfo()
     {
         logWriter = logWriter,
         logFormatter = logFormatter
     });
 }
开发者ID:moszinet,项目名称:HomeAutomation,代码行数:8,代码来源:Log.cs

示例10: TestCommonLoggingEntlibTraceListener

 public TestCommonLoggingEntlibTraceListener(CommonLoggingEntlibTraceListenerData data, ILogFormatter logFormatter)
     : base(data, logFormatter)
 {
     if (Instance != null)
     {
         throw new NotSupportedException(this.GetType().FullName + " supports only one instance");
     }
     Instance = this;
 }
开发者ID:Rocketmakers,项目名称:common-logging,代码行数:9,代码来源:TestCommonLoggingEntlibTraceListener.cs

示例11: CsvFileOutputHandler

        public CsvFileOutputHandler(ILogFilters filters, ILogFormatter formatter, String filePath)
        {
            if (filters == null)
                throw new ArgumentNullException("filters", "A valid set of log filters is required for proper operation.");

            this.Filters = filters;
            this.Formatter = formatter;
            this.FilePath = filePath;
        }
开发者ID:mdabbagh88,项目名称:YALF,代码行数:9,代码来源:CsvFileOutputHandler.cs

示例12: CachedEmailTraceListener

 public CachedEmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, ILogFormatter formatter, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL, double emailCacheDuration)
     : base(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, formatter, authenticationMode, userName, password, useSSL)
 {
     this.emailCacheDuration = emailCacheDuration;
     if (emailCacheDuration > 0)
     {
         // Email cache duration is in hours
         this.cacheItemPolicyFactory = new AbsoluteCacheItemPolicyFactory(Convert.ToInt32(emailCacheDuration * 3600));
     }
 }
开发者ID:RustyF,项目名称:EnergyTrading-Core,代码行数:10,代码来源:CachedEmailTraceListener.cs

示例13: MsmqTraceListener

        /// <summary>
        /// Initializes a new instance of <see cref="MsmqTraceListener"/>.
        /// </summary>
        /// <param name="name">The name of the new instance.</param>
        /// <param name="queuePath">The path to the queue to deliver to.</param>
        /// <param name="formater">The formatter to use.</param>
        /// <param name="messagePriority">The priority for the messages to send.</param>
        /// <param name="recoverable">The recoverable flag for the messages to send.</param>
        /// <param name="timeToReachQueue">The timeToReachQueue for the messages to send.</param>
        /// <param name="timeToBeReceived">The timeToBeReceived for the messages to send.</param>
        /// <param name="useAuthentication">The useAuthentication flag for the messages to send.</param>
        /// <param name="useDeadLetterQueue">The useDeadLetterQueue flag for the messages to send.</param>
        /// <param name="useEncryption">The useEncryption flag for the messages to send.</param>
        /// <param name="transactionType">The <see cref="MessageQueueTransactionType"/> for the message to send.</param>
        public MsmqTraceListener(string name, string queuePath, ILogFormatter formater,
								 MessagePriority messagePriority, bool recoverable,
								 TimeSpan timeToReachQueue, TimeSpan timeToBeReceived,
								 bool useAuthentication, bool useDeadLetterQueue, bool useEncryption,
								 MessageQueueTransactionType transactionType)
            : this(name, queuePath, formater, messagePriority, recoverable,
				   timeToReachQueue, timeToBeReceived,
				   useAuthentication, useDeadLetterQueue, useEncryption,
				   transactionType, new MsmqSendInterfaceFactory())
        {
        }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:25,代码来源:MsmqTraceListener.cs

示例14: TextWriterOutputHandler

        public TextWriterOutputHandler(TextWriter writer, ILogFilters filters, ILogFormatter formatter)
        {
            if (writer == null)
                throw new ArgumentNullException("writer", "A valid stream writer is required for proper operation.");
            if (filters == null)
                throw new ArgumentNullException("filters", "A valid set of log filters is required for proper operation.");

            this.Filters = filters;
            this.Formatter = formatter;
            this.Writer = writer;
        }
开发者ID:mdabbagh88,项目名称:YALF,代码行数:11,代码来源:TextWriterOutputHandler.cs

示例15: MonitoringDatabaseTraceListener

 /// <summary>
 /// Initializes a new instance of <see cref="MonitoringDatabaseTraceListener"/>.
 /// </summary>
 /// <param name="database">The database for writing the log.</param>
 /// <param name="formatter">The formatter.</param>
 /// <param name="applicationName">Name of the application.</param>
 /// <param name="connectionStringName">Name of the connection string.</param>
 public MonitoringDatabaseTraceListener(Database database, ILogFormatter formatter, string applicationName,
     string connectionStringName)
     : base(formatter)
 {
     _database = database;
     if (string.IsNullOrEmpty(applicationName))
     {
         throw new ArgumentNullException("applicationName");
     }
     _applicationName = applicationName;
     _connectionStringName = connectionStringName;
 }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:19,代码来源:MonitoringDatabaseTraceListener.cs


注:本文中的ILogFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。