• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ILogFormatter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ToString

        public string ToString(ILogFormatter formatter)
        {
            if (formatter == null) return ToString();

            try
            {
                return formatter.Format(this);
            }
            catch
            {
                return ToString();
            }
        }
开发者ID:subfuzion,项目名称:dotlog,代码行数:13,代码来源:LogEntry.cs


示例17: FlatFileListener

 public FlatFileListener(string fileName,
     string header = "----------------------------------",
     string footer = "----------------------------------",
     ILogFormatter formatter = null,
     int rollSizeKb = 20000,
     string timeStampPattern = "yyyy-MM-dd hh:mm:ss",
     RollFileExistsBehavior rollFileExistsBehavior = RollFileExistsBehavior.Increment,
     RollInterval rollInterval = RollInterval.Day,
     int maxArchivedFiles = 0)
     : base(Path.Combine(ResolveLogPath(), fileName), header, footer, formatter, rollSizeKb, timeStampPattern,
         rollFileExistsBehavior, rollInterval, maxArchivedFiles)
 {
 }
开发者ID:Enyu,项目名称:MSEnterpriseLogging,代码行数:13,代码来源:FlatFileListener.cs


示例18: LogglyTraceListener

        public LogglyTraceListener(string name, ILogFormatter formatter, string logglyInputKey)
        {
            if (string.IsNullOrEmpty(logglyInputKey))
            {
                throw new ConfigurationSourceErrorsException("Invalid values in LogglyTraceListener configuration.");
            }
            else
            {
                this.Logger = new Loggly.Logger(logglyInputKey);
            }

            this.Formatter = formatter;
            this.Name = name;
        }
开发者ID:ajedwards,项目名称:Loggly.EntLib,代码行数:14,代码来源:LogglyTraceListener.cs


示例19: EmailMessage

 /// <summary>
 /// Initializes a <see cref="EmailMessage"/> with the raw data to create and email, the logentry, 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="logEntry">The LogEntry <see cref="LogEntry"/> to send via email.</param>
 /// <param name="formatter">The Formatter <see cref="ILogFormatter"/> which determines how the 
 /// email message should be formatted</param>
 /// <param name="authenticationMode">Authenticate mode to use when connecting to SMTP server.</param>
 /// <param name="userName">User name to send to SMTP server if using username/password authentication.</param>
 /// <param name="password">Password to send to SMTP server if using username/password authentication.</param>
 /// <param name="useSSL">Use SSL to connect to STMP server - if true, yes, if false, no.</param>
 public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, LogEntry logEntry, ILogFormatter formatter,
     EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
 {
     this.configurationData = new EmailTraceListenerData(toAddress, fromAddress, subjectLineStarter,
                                                         subjectLineEnder, smtpServer, smtpPort, string.Empty)
                                  {
                                      AuthenticationMode = authenticationMode,
                                      UserName = userName,
                                      Password = password,
                                      UseSSL = useSSL
                                  };
     this.logEntry = logEntry;
     this.formatter = formatter;
 }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:30,代码来源:EmailMessage.cs


示例20: 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>
 public MsmqTraceListener(string name,
                          string queuePath,
                          ILogFormatter formatter)
     : this(name,
            queuePath,
            formatter,
            MsmqTraceListenerData.DefaultPriority,
            MsmqTraceListenerData.DefaultRecoverable,
            MsmqTraceListenerData.DefaultTimeToReachQueue,
            MsmqTraceListenerData.DefaultTimeToBeReceived,
            MsmqTraceListenerData.DefaultUseAuthentication,
            MsmqTraceListenerData.DefaultUseDeadLetter,
            MsmqTraceListenerData.DefaultUseEncryption,
            MsmqTraceListenerData.DefaultTransactionType)
 { }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:21,代码来源:MsmqTraceListener.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ILogManager类代码示例发布时间:2022-05-24
下一篇:
C# ILogFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap