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


C# ILogger.Information方法代码示例

本文整理汇总了C#中ILogger.Information方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.Information方法的具体用法?C# ILogger.Information怎么用?C# ILogger.Information使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILogger的用法示例。


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

示例1: WriteQueryToStream

        public override async Task WriteQueryToStream(Stream stream, ILogger logger, Spec.Query query, CancellationToken cancellationToken)
        {
            using (var memoryBuffer = new MemoryStream(1024))
            using (var streamWriter = new StreamWriter(memoryBuffer, utf8Encoding))
            {
                WriteQuery(new JsonWriter(streamWriter), query);
                streamWriter.Flush();

                var data = memoryBuffer.ToArray();
                memoryBuffer.Seek(0, SeekOrigin.Begin);

                if (logger.InformationEnabled())
                {
                    string dataStr = Encoding.UTF8.GetString(data);
                    logger.Information("JSON query: {0}", dataStr);
                }

                var tokenHeader = BitConverter.GetBytes(query.token);
                if (!BitConverter.IsLittleEndian)
                    Array.Reverse(tokenHeader, 0, tokenHeader.Length);
                memoryBuffer.Write(tokenHeader, 0, tokenHeader.Length);

                var lengthHeader = BitConverter.GetBytes(data.Length);
                if (!BitConverter.IsLittleEndian)
                    Array.Reverse(lengthHeader, 0, lengthHeader.Length);
                memoryBuffer.Write(lengthHeader, 0, lengthHeader.Length);

                memoryBuffer.Write(data, 0, data.Length);

                logger.Debug("Writing packet, {0} bytes", data.Length);
                data = memoryBuffer.ToArray();
                await stream.WriteAsync(data, 0, data.Length, cancellationToken);
            }
        }
开发者ID:karlgrz,项目名称:rethinkdb-net,代码行数:34,代码来源:Version_0_3_JsonProtocol.cs

示例2: ProductsController

        static ProductsController()
        {
            Logger = Log.ForContext<ProductsController>();
            Products = new Fixture().CreateMany<Product>(500).OrderBy(p => p.Id).ToList();

            Logger.Information("created the products {ProductCount}", Products.Count());
        }
开发者ID:vip32,项目名称:Xtricate,代码行数:7,代码来源:ProductsController.cs

示例3: PatchGame

        private static void PatchGame(ILogger log)
        {
            log.Information("Creating {0}", Paths.PatchedAssemblyFolder);
            Directory.CreateDirectory(Paths.PatchedAssemblyFolder);

            log.Information("Loading original assembly {0}", Paths.OriginalAssembly);
            var patcher = new AssemblyPatcher(Paths.OriginalAssembly, log);
            patcher.EmbedHistory = false;
            patcher.UseBackup = false;

            log.Information("Patching");
            patcher.PatchAssembly(typeof(W2PWMod.ModType).Assembly.Location);

            log.Information("Saving patched file");
            patcher.WriteTo(Paths.PatchedAssembly);
        }
开发者ID:bman654,项目名称:wasteland2-patchwork,代码行数:16,代码来源:ApplyPatch.cs

示例4: LoggingScope

 internal LoggingScope(ILogger logger, string messageTemplate, params object[] propertyValues)
 {
     _Logger = logger;
     _MessageTemplate = messageTemplate;
     _PropertyValues = propertyValues;
     _StopWatch = new Stopwatch();
     _StopWatch.Start();
     _Logger.Information($">> Started: \"{_MessageTemplate}\"", _PropertyValues);
 }
开发者ID:joelweiss,项目名称:DbConnection.Serilog,代码行数:9,代码来源:LoggingScope.cs

示例5: NamedPipePoshGitServer

        public NamedPipePoshGitServer(IRepositoryCache repoCache, ILifetimeScope lifetimeScope, ILogger log)
        {
            _log = log;
            _cancellationTokenSource = new CancellationTokenSource();
            _repoCache = repoCache;
            _serializer = JsonSerializer.Create();
            _lifetimeScope = lifetimeScope;

            log.Information("Server started");
        }
开发者ID:areyling,项目名称:poshgit2,代码行数:10,代码来源:NamedPipePoshGitServer.cs

示例6: Setup

        public void Setup()
        {
            _exception = new Exception("An Error");
            _log = new LoggerConfiguration()
                .WriteTo.Sink(new NullSink())
                .CreateLogger();

            // Ensure template is cached
            _log.Information(_exception, "Hello, {Name}!", "World");
        }
开发者ID:serilog,项目名称:serilog,代码行数:10,代码来源:PipelineBenchmark.cs

示例7: Before

        public static void Before()
        {
            logger = new LoggerConfiguration()
                    .ReadFrom.AppSettings()
                    .Enrich.WithMachineName()
                    .Enrich.FromLogContext()
                    .CreateLogger();

            Log.Logger = logger;
            logger.Information("Logger has been initialized!");
        }
开发者ID:Peymanmi,项目名称:Serilog.Sinks.RollingFile.Extension,代码行数:11,代码来源:Setup.cs

示例8: NinjectCore

        public NinjectCore(IKernel kernel, ILogger logger, ICoreSettings settings)
        {
            _kernel = kernel;
            _logger = logger;
            _settings = settings;

            _logger.Information("Initializing Core.");

            InitializeKernel();
            InitializeExtensions();

            _logger.Verbose("Core initilized.");
        }
开发者ID:insightful-systems,项目名称:Digitaural,代码行数:13,代码来源:NinjectCore.cs

示例9: WindowMessageHook

        public WindowMessageHook(
            IEnumerable<IWindowMessageInterceptor> windowMessageInterceptors,
            ILogger logger,
            IConsumerThreadLoop consumerLoop)
        {
            this.windowMessageInterceptors = windowMessageInterceptors;
            this.logger = logger;
            this.consumerLoop = consumerLoop;

            pendingMessages = new Queue<WindowMessageReceivedArgument>();
            cancellationTokenSource = new CancellationTokenSource();

            logger.Information($"Window message hook was constructed using {windowMessageInterceptors.Count()} interceptors.");
        }
开发者ID:fourgood,项目名称:Shapeshifter,代码行数:14,代码来源:WindowMessageHook.cs

示例10: OneTimePhoneEmulatorDialogMonitor

 public OneTimePhoneEmulatorDialogMonitor(ILogger logger)
 {
     _logger = logger;
     _windowsPhoneEmulatorDialogMonitor = new WindowsPhoneEmulatorDialogMonitor(logger);
     _timer = new Timer(1000);
     _timer.Elapsed += (sender, e) => _windowsPhoneEmulatorDialogMonitor.ExecuteDialogSlapDown(msg =>
     {
         _logger.Information(msg);
         _timer.Stop();
         _timer = null;
         _windowsPhoneEmulatorDialogMonitor = null;
     });
     _timer.Start();
 }
开发者ID:staxmanade,项目名称:StatLight,代码行数:14,代码来源:WindowsPhoneEmulatorDialogMonitor.cs

示例11: WindowMessageHook

        public WindowMessageHook(
            IReadOnlyCollection<IWindowMessageInterceptor> windowMessageInterceptors,
            ILogger logger,
            IConsumerThreadLoop consumerLoop,
            IMainWindowHandleContainer mainWindowHandleContainer)
        {
            this.windowMessageInterceptors = windowMessageInterceptors;
            this.logger = logger;
            this.consumerLoop = consumerLoop;
            this.mainWindowHandleContainer = mainWindowHandleContainer;

            pendingMessages = new Queue<WindowMessageReceivedArgument>();
            cancellationTokenSource = new CancellationTokenSource();

            logger.Information(
                $"Window message hook was constructed using {windowMessageInterceptors.Count} interceptors.");
        }
开发者ID:gitter-badger,项目名称:Shapeshifter,代码行数:17,代码来源:WindowMessageHook.cs

示例12: EfMigrator

        public EfMigrator(string assemblyPath, string qualifiedDbConfigName, string appConfigPath, string connectionString, string connectionProvider,
                          ILogger logger)
        {
            _logger = logger;

            appConfigPath = Path.GetFullPath(appConfigPath);
            if (!File.Exists(appConfigPath))
            {
                throw new EfMigrationException($"The {nameof(appConfigPath)} '{appConfigPath}' must exist.");
            }

            var domainSetup = AppDomain.CurrentDomain.SetupInformation;
            domainSetup.ConfigurationFile = appConfigPath;
            _logger.Debug($"Prepared AppDomain setup using {appConfigPath} as the appconfig.");

            var domainName = $"EfMigrator:{Guid.NewGuid()}";
            _domain = AppDomain.CreateDomain(domainName, null, domainSetup);
            _logger.Debug($"Created new AppDomain named {domainName}.");

            var type = typeof(EfMigratorBackend);

            var fullPath = Assembly.GetAssembly(typeof(EfMigratorBackend)).Location;
            //var domain = AppDomain.CurrentDomain.GetAssemblies()
            //                      .Where(x => !x.IsDynamic)
            //                      .Where(x => !x.GlobalAssemblyCache)
            //                      .Select(x => Path.GetDirectoryName(x.Location))
            //                      .Distinct();

            //var domains = string.Join(", ", domain);
            //logger.Debug($"Loading assemblies into appDomain: {domains}.");

            Debug.Assert(fullPath != null, "fullPath != null");

            var migrator = (EfMigratorBackend) _domain.CreateInstanceFromAndUnwrap(fullPath, type.FullName);
            _logger.Debug("Created new instance.");
            migrator.Initialize(assemblyPath, qualifiedDbConfigName, connectionString, connectionProvider);

            _logger.Debug($"Initialized new {nameof(EfMigratorBackend)} within {domainName}.");

            CurrentMigration = migrator.GetCurrentMigration() ?? InitialDatabase;
            var currentMigrationStr = CurrentMigration == InitialDatabase ? "$InitialDatabase" : CurrentMigration;
            _logger.Information($"Current Migration is {currentMigrationStr}.");

            _migratorBackend = migrator;
        }
开发者ID:Silvenga,项目名称:Cake.EntityFramework,代码行数:45,代码来源:EfMigrator.cs

示例13: OnStart

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            _container = new UnityContainer();
            AccidentalFish.ApplicationSupport.Core.Bootstrapper.RegisterDependencies(_container);
            AccidentalFish.ApplicationSupport.Azure.Bootstrapper.RegisterDependencies(_container);
            Domain.Bootstrapper.RegisterDependencies(_container);
            Domain.Bootstrapper.RegisterInfrastructure(_container);
            AccidentalFish.ApplicationSupport.Processes.Bootstrapper.RegisterDependencies(_container);

            ILoggerFactory loggerFactory = _container.Resolve<ILoggerFactory>();
            _logger = loggerFactory.CreateLongLivedLogger(new LoggerSource("com.accidentalfish.azurelinkboard.background.worker-role"));
            _logger.Information("Starting background worker role instance");

            return base.OnStart();
        }
开发者ID:JamesRandall,项目名称:AzureLinkboard,代码行数:18,代码来源:WorkerRole.cs

示例14: MessagePathConfigurator

        public MessagePathConfigurator(IPathTemplatesProvider pathTemplateProvider, ILogger logger)
        {
            if (pathTemplateProvider == null) throw new ArgumentNullException("pathTemplateProvider");
            if (logger == null) throw new ArgumentNullException("logger");

            _logger = logger;
            _pathTemplateProvider = pathTemplateProvider;
            _pathTemplateProvider.PathTemplates.CollectionChanged += PathTemplatesCollectionChanged;

            DefaultSavePath = AppDomain.CurrentDomain.BaseDirectory;
            RenderLoadPaths();

            if (LoadPaths.Any()) DefaultSavePath = LoadPaths.First();

            _logger.Information(
                "Default Message Save Path is Set to {DefaultSavePath}",
                DefaultSavePath);
        }
开发者ID:sravimohan,项目名称:Papercut,代码行数:18,代码来源:MessagePathConfigurator.cs

示例15: OnStart

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            var builder = new ContainerBuilder();

            builder.RegisterType<FixItQueueManager>().As<IFixItQueueManager>();
            builder.RegisterType<FixItTaskRepository>().As<IFixItTaskRepository>().SingleInstance();
            builder.RegisterType<Logger>().As<ILogger>().SingleInstance();

            container = builder.Build();

            logger = container.Resolve<ILogger>();

            bool result = base.OnStart();

            logger.Information("MyFixItWorkerRole has been started");

            return result;
        }
开发者ID:hongbo105,项目名称:BufferOverflow,代码行数:24,代码来源:WorkerRole.cs


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