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


C# Logging.LogWriter类代码示例

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


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

示例1: AccessImporter

 public AccessImporter(LogWriter logger, LO30Context context, bool seed = true)
 {
   _logger = logger;
   _context = context;
   _lo30ContextService = new LO30ContextService(context);
   _seed = seed;
 }
开发者ID:dkhunt27,项目名称:LO30.v3,代码行数:7,代码来源:AccessImporter.cs

示例2: LogService

        static LogService()
        {
            var formatter = new TextFormatter
                ("Timestamp: {timestamp}{newline}" +
                 "Message: {message}{newline}" +
                 "Category: {category}{newline}");

            //Create the Trace listeners
            var logFileListener = new FlatFileTraceListener(@"C:\temp\temp.log", "",
                                                            "", formatter);

            //Add the trace listeners to the source
            var mainLogSource =
                new LogSource("MainLogSource", SourceLevels.All);
            mainLogSource.Listeners.Add(logFileListener);

            var nonExistantLogSource = new LogSource("Empty");

            IDictionary<string, LogSource> traceSources =
                new Dictionary<string, LogSource>
                    {{"Info", mainLogSource}, {"Warning", mainLogSource}, {"Error", mainLogSource}};

            Writer = new LogWriterImpl(new ILogFilter[0],
                                       traceSources,
                                       nonExistantLogSource,
                                       nonExistantLogSource,
                                       mainLogSource,
                                       "Info",
                                       false,
                                       true);
        }
开发者ID:Raconeisteron,项目名称:bakopanos,代码行数:31,代码来源:LogService.cs

示例3: MyLoggingExceptionHandler

 internal MyLoggingExceptionHandler(string logCategory, int eventId, TraceEventType severity, string title, int priority, 
     Type formatterType, LogWriter writer, DocumentModel doc)
     : base(logCategory, eventId, severity, title, priority, formatterType, writer)
 {
     this.m_Writer = writer;
     this.doc = doc;
 }
开发者ID:NMO13,项目名称:SolidTurn,代码行数:7,代码来源:ExceptionSupport.cs

示例4: EnterpriseLibraryLogger

        public EnterpriseLibraryLogger(LoggingConfiguration config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            m_LogWriter = new LogWriter(config);
        }
开发者ID:Hirede,项目名称:Logging,代码行数:7,代码来源:EnterpriseLibraryLogger.cs

示例5: ShellViewModel

        public ShellViewModel(
            IRegionManager regionManager, 
            IEventAggregator eventAggregator, 
            INavigationService navigationService, 
            IApplicationCommands applicationCommands, 
            LogWriter logWriter)
        {
            this.regionManager = regionManager;
            this.eventAggregator = eventAggregator;
            this.navigationService = navigationService;
            this.applicationCommands = applicationCommands;
            this.logWriter = logWriter;
            this.EntitySelectorViews = new List<KeyValuePair<string, Type>>();
            this.ExitCommand = new DelegateCommand<object>(this.AppExit, this.CanAppExit);
            this.eventAggregator.Subscribe<BusyEvent>(this.SetBusy);
            this.eventAggregator.Subscribe<DialogOpenEvent>(this.DialogOpened);
            this.eventAggregator.Subscribe<StatusEvent>(this.UpdateStatus);
            this.eventAggregator.Subscribe<ErrorEvent>(this.ShowError);
            this.eventAggregator.Subscribe<CanSaveEvent>(this.UpdateCanSave);
            this.eventAggregator.Subscribe<EntitySelectEvent>(this.ShowSelectEntity);
            this.eventAggregator.Subscribe<EntitySelectedEvent>(this.HideSelectEntity);
            this.eventAggregator.Subscribe<MappingUpdateEvent>(this.ShowUpdateMapping);
            this.eventAggregator.Subscribe<MappingUpdatedEvent>(this.HideUpdateMapping);
            this.eventAggregator.Subscribe<CanCreateNewChangeEvent>(this.CanCreateNewChange);
            this.eventAggregator.Subscribe<CanCloneChangeEvent>(this.CanCloneChange);
            this.eventAggregator.Subscribe<ConfirmMappingDeleteEvent>(this.ConfirmMappingDelete);
            this.eventAggregator.Subscribe<MappingDeleteConfirmedEvent>(this.MappingDeleteConfirmed);
            this.NewEntityMenuItems = new ObservableCollection<MenuItemViewModel>();

            this.serverList = new ObservableCollection<string>();
            this.SetServerList();

            this.HelpToolTip = "Help Documentation (" + Assembly.GetExecutingAssembly().GetName().Version + ")";
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:34,代码来源:ShellViewModel.cs

示例6: Main

        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            try
            {
                logWriter = ConfigureEntLibLogging.ConfigureLogWriter();

                if (logWriter.IsLoggingEnabled())
                {
                    using (logWriter)
                    {
                        logWriter.Write("Enterprise Library Logging test app has been started!");
                    }
                }

                //EntLibLogTest logTest = new EntLibLogTest();
                //logTest.PrintLogEvent();
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                return;
            }
            finally
            {
                logWriter.Dispose();
            }
        }
开发者ID:paulmac2015,项目名称:loggingframeworks,代码行数:31,代码来源:Program.cs

示例7: SimpleLogWriterWrite

        static void SimpleLogWriterWrite()
        {
          // Build the configuration programtically.
          LoggingConfiguration loggingConfiguration = BuildProgrammaticConfig();
          defaultWriter = new LogWriter(loggingConfiguration);


          // Check if logging is enabled before creating log entries.
            if (defaultWriter.IsLoggingEnabled())
            {
                // The default values if not specified in call to Write method are:
                // - Category: "General"
                // - Priority: -1
                // - Event ID: 1
                // - Severity: Information
                // - Title: [none]
                defaultWriter.Write("Log entry created using the simplest overload.");
                Console.WriteLine("Created a Log Entry using the simplest overload.");
                defaultWriter.Write("Log entry with a single category.", "General");
                Console.WriteLine("Created a Log Entry with a single category.");
                defaultWriter.Write("Log entry with a category, priority, and event ID.", "General", 6, 9001);
                Console.WriteLine("Created a Log Entry with a category, priority, and event ID.");
                defaultWriter.Write("Log entry with a category, priority, event ID, and severity.", "General", 5, 9002, TraceEventType.Warning);
                Console.WriteLine("Created a Log Entry with a category, priority, event ID, and severity.");
                defaultWriter.Write("Log entry with a category, priority, event ID, severity, and title.", "General", 8, 9003, TraceEventType.Warning, "Logging Block Examples");
                Console.WriteLine("Created a Log Entry with a category, priority, event ID, severity, and title.");
                Console.WriteLine();
                Console.WriteLine(@"Open 'C:\Temp\ConfigSampleFlatFile.log' to see the results.");
            }
            else
            {
                Console.WriteLine("Logging is disabled in the configuration.");
            }
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:34,代码来源:Program.cs

示例8: Logger

        private Logger()
        {
            TraceManager traceMgr;

            DatabaseProviderFactory factory = new DatabaseProviderFactory(new SystemConfigurationSource(false).GetSection);
            DatabaseFactory.SetDatabaseProviderFactory(factory, false);

            LoggingConfiguration loggingConfiguration = BuildProgrammaticConfig();
            defaultWriter = new LogWriter(loggingConfiguration);

            // Create a TraceManager object for use in activity tracing example.
            traceMgr = new TraceManager(defaultWriter);
            try
            {
                if (!Directory.Exists(@"C:\Temp"))
                {
                    Directory.CreateDirectory(@"C:\Temp");
                }
            }
            catch
            {
                //Console.WriteLine(@"WARNING: Folder C:\Temp cannot be created for disk log files");
                //Console.WriteLine();
            }
        }
开发者ID:KeyHu,项目名称:SanscsHomework,代码行数:25,代码来源:Logger.cs

示例9: LcboInventoryServiceAgent

 /// <summary>
 /// Initializes a new instance of the <see cref="LcboInventoryServiceAgent"/> class.
 /// </summary>
 /// <param name="pageRetrieverFactory">The page retriever factory.</param>
 public LcboInventoryServiceAgent(
     [ServiceDependency]IPageRetrieverFactory pageRetrieverFactory
     )
 {
     this.pageRetriever = pageRetrieverFactory.InventoryPageRetriever;
     this.logWriter = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();
     this.traceManager = new TraceManager(this.logWriter);
 }
开发者ID:claq2,项目名称:lcbodrinkfinder,代码行数:12,代码来源:LcboInventoryServiceAgent.cs

示例10: MagicLogger

 public MagicLogger()
 {
     var config = new LoggingConfiguration();
     var txtFormatter = new TxtFormatter(new NameValueCollection());
     config.AddLogSource("Error", SourceLevels.Error, true).AddTraceListener(new FlatFileListener("error.txt", formatter: txtFormatter));
     config.AddLogSource("Information", SourceLevels.Information, true).AddTraceListener(new FlatFileListener("information.txt", formatter: txtFormatter));
     var loggerWriter = new LogWriter(config);
     Logger.SetLogWriter(loggerWriter, false);
 }
开发者ID:Enyu,项目名称:MSEnterpriseLogging,代码行数:9,代码来源:MagicLogger.cs

示例11: CleanerService

        public CleanerService()
        {
            InitializeComponent();
            _logger = new LogWriter(BuildProgrammaticConfig());

            _cacheDir = ConfigurationManager.AppSettings[OfficeCacheFolderKey];
            _maxAgeMinutes = int.Parse(ConfigurationManager.AppSettings[LastAccessTimeMinutesBeforeDeleteKey]);
            _cleanIntervalMinutes = int.Parse(ConfigurationManager.AppSettings[CleanIntervalMinutes]);
        }
开发者ID:webhacking,项目名称:OfficeCacheCleaner,代码行数:9,代码来源:CleanerService.cs

示例12: LcboProductServiceAgent

 public LcboProductServiceAgent(
     [ServiceDependency]IPageRetrieverFactory pageRetrieverFactory
     )
 {
     this.productDetailsPageRetriever = pageRetrieverFactory.ProductDetailsPageRetriever;
     this.productListPageRetriever = pageRetrieverFactory.ProductListPageRetriever;
     this.logWriter = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();
     this.traceManager = new TraceManager(this.logWriter);
 }
开发者ID:claq2,项目名称:lcbodrinkfinder,代码行数:9,代码来源:LcboProductServiceAgent.cs

示例13: EntLibLogger

        public EntLibLogger(LogWriter logWriter)
        {
            if (logWriter == null)
            {
                throw new ArgumentNullException("logWriter");
            }

            this.logWriter = logWriter;
        }
开发者ID:RustyF,项目名称:EnergyTrading-Core,代码行数:9,代码来源:EntLibLogger.cs

示例14: AdvSurveysController

        public AdvSurveysController(ISurveyService surveyService,
            IDipendentiService dipendentiService,
            LogWriter logger
            )
        {
            this.surveyService = surveyService;
            this.logger = logger;

        }
开发者ID:salem84,项目名称:GeCo.Survey,代码行数:9,代码来源:AdvSurveysController.cs

示例15: PersonalLocationsController

 /// <summary>
 /// Initializes a new instance of the <see cref="PersonalLocationsController"/> class.
 /// </summary>
 public PersonalLocationsController(
     [CreateNew] IDomainContext domainContext,
     [ServiceDependency] IGeoLocationServiceAgent geoLocationService
     )
 {
     this.logWriter = EnterpriseLibraryContainer.Current.GetInstance<LogWriter>();
     this.traceManager = new TraceManager(this.logWriter);
     this.geoLocationService = geoLocationService;
     this.domainContext = domainContext;
 }
开发者ID:claq2,项目名称:lcbodrinkfinder,代码行数:13,代码来源:PersonalLocationsController.cs


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