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


C# ILogger.Verbose方法代码示例

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


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

示例1: StratumMiner

        /// <summary>
        /// Creates a new miner instance.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="extraNonce"></param>
        /// <param name="connection"></param>
        /// <param name="pool"></param>
        /// <param name="minerManager"></param>
        /// <param name="storageLayer"></param>
        public StratumMiner(int id, UInt32 extraNonce, IConnection connection, IPool pool, IMinerManager minerManager, IStorageLayer storageLayer)
        {
            Id = id; // the id of the miner.
            ExtraNonce = extraNonce;
            Connection = connection; // the underlying connection.
            Pool = pool;
            _minerManager = minerManager;
            _storageLayer = storageLayer;

            Subscribed = false; // miner has to subscribe.
            Authenticated = false; // miner has to authenticate.

            _logger = Log.ForContext<StratumMiner>().ForContext("Component", pool.Config.Coin.Name);
            _packetLogger = LogManager.PacketLogger.ForContext<StratumMiner>().ForContext("Component", pool.Config.Coin.Name);

            _rpcResultHandler = callback =>
            {
                var asyncData = ((JsonRpcStateAsync)callback); // get the async data.
                var result = asyncData.Result + "\n"; // read the result.
                var response = Encoding.UTF8.GetBytes(result); // set the response.

                Connection.Send(response); // send the response.

                _packetLogger.Verbose("tx: {0}", result.PrettifyJson());
            };
        }
开发者ID:carloslozano,项目名称:CoiniumServ,代码行数:35,代码来源:StratumMiner.cs

示例2: 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

示例3: WebServer

        public WebServer(INancyBootstrapper webBootstrapper, IConfigManager configManager)
            : base(webBootstrapper)
        {
            var config = configManager.WebServerConfig;
            BindIP = config.BindInterface;
            Port = config.Port;

            _logger = Log.ForContext<WebServer>();

            if (config.Enabled)
                Start();
            else
                _logger.Verbose("Skipping web-server initialization as it disabled.");
        }
开发者ID:nuggetbram,项目名称:coinium-whrl,代码行数:14,代码来源:WebServer.cs

示例4: BluetoothProfileActivator

        public BluetoothProfileActivator(IBluetoothService bluetoothService,
            IPersonalizationSettings personalizationSettings,
            ISchedulerProvider schedulerProvider,
            ILoggerFactory loggerFactory)
        {
            _bluetoothService = bluetoothService;
            _personalizationSettings = personalizationSettings;
            _schedulerProvider = schedulerProvider;
            _logger = loggerFactory.CreateLogger(GetType());
            _bluetoothEventLoop = _schedulerProvider.CreateEventLoopScheduler("BluetoothActivator");
            _logger.Verbose("BluetoothProfileActivator.ctor();");

            _profileActivated = _bluetoothService.IdentitiesActivated(_bluetoothEventLoop)
                .Retry()
                .Repeat()
                .Log(_logger, "IdentitiesActivated")
                .Select(Translate)
                .Publish();

            //HACK: Avoid work in the ctor. Can be smart here using SelectMany on the IsEnabled + Connecting when ProfileActivated is subscribed to. -LC
            if (_bluetoothService.IsSupported && IsEnabled)
                _connection.Disposable = _profileActivated.Connect();
        }
开发者ID:CallWall,项目名称:CallWall.Windows,代码行数:23,代码来源:BluetoothActivator.cs

示例5: MigrateAssetIfNeeded

        public static bool MigrateAssetIfNeeded(ILogger log, string assetFullPath)
        {
            // Determine if asset was Yaml or not
            var assetFileExtension = Path.GetExtension(assetFullPath);
            if (assetFileExtension == null)
                return false;

            assetFileExtension = assetFileExtension.ToLowerInvariant();

            var serializer = AssetSerializer.FindSerializer(assetFileExtension);
            if (!(serializer is AssetYamlSerializer))
                return false;

            // We've got a Yaml asset, let's get expected and serialized versions
            var serializedVersion = 0;
            int expectedVersion;
            Type assetType;

            // Read from Yaml file the asset version and its type (to get expected version)
            // Note: It tries to read as few as possible (SerializedVersion is expected to be right after Id, so it shouldn't try to read further than that)
            using (var streamReader = new StreamReader(assetFullPath))
            {
                var yamlEventReader = new EventReader(new Parser(streamReader));

                // Skip header
                yamlEventReader.Expect<StreamStart>();
                yamlEventReader.Expect<DocumentStart>();
                var mappingStart = yamlEventReader.Expect<MappingStart>();

                var yamlSerializerSettings = YamlSerializer.GetSerializerSettings();
                var tagTypeRegistry = yamlSerializerSettings.TagTypeRegistry;
                assetType = tagTypeRegistry.TypeFromTag(mappingStart.Tag);

                expectedVersion = AssetRegistry.GetCurrentFormatVersion(assetType);

                Scalar assetKey;
                while ((assetKey = yamlEventReader.Allow<Scalar>()) != null)
                {
                    // Only allow Id before SerializedVersion
                    if (assetKey.Value == "Id")
                    {
                        yamlEventReader.Skip();
                        continue;
                    }
                    if (assetKey.Value == "SerializedVersion")
                    {
                        serializedVersion = Convert.ToInt32(yamlEventReader.Expect<Scalar>().Value, CultureInfo.InvariantCulture);
                        break;
                    }
                }
            }

            if (serializedVersion > expectedVersion)
            {
                // Try to open an asset newer than what we support (probably generated by a newer Paradox)
                throw new InvalidOperationException(string.Format("Asset of type {0} has been serialized with newer version {1}, but only version {2} is supported. Was this asset created with a newer version of Paradox?", assetType, serializedVersion, expectedVersion));
            }

            if (serializedVersion < expectedVersion)
            {
                // Perform asset upgrade
                log.Verbose("{0} needs update, from version {1} to version {2}", Path.GetFullPath(assetFullPath), serializedVersion, expectedVersion);

                // Load the asset as a YamlNode object
                var input = new StringReader(File.ReadAllText(assetFullPath));
                var yamlStream = new YamlStream();
                yamlStream.Load(input);
                var yamlRootNode = (YamlMappingNode)yamlStream.Documents[0].RootNode;

                // Check if there is any asset updater
                var assetUpgraders = AssetRegistry.GetAssetUpgraders(assetType);
                if (assetUpgraders == null)
                {
                    throw new InvalidOperationException(string.Format("Asset of type {0} should be updated from version {1} to {2}, but no asset migration path was found", assetType, serializedVersion, expectedVersion));
                }

                // Instantiate asset updaters
                var currentVersion = serializedVersion;
                while (currentVersion != expectedVersion)
                {
                    int targetVersion;
                    // This will throw an exception if no upgrader is available for the given version, exiting the loop in case of error.
                    var upgrader = assetUpgraders.GetUpgrader(currentVersion, out targetVersion);
                    upgrader.Upgrade(currentVersion, targetVersion, log, yamlRootNode);
                    currentVersion = targetVersion;
                }

                // Make sure asset is updated to latest version
                YamlNode serializedVersionNode;
                var newSerializedVersion = 0;
                if (yamlRootNode.Children.TryGetValue(new YamlScalarNode("SerializedVersion"), out serializedVersionNode))
                {
                    newSerializedVersion = Convert.ToInt32(((YamlScalarNode)serializedVersionNode).Value);
                }

                if (newSerializedVersion != expectedVersion)
                {
                    throw new InvalidOperationException(string.Format("Asset of type {0} was migrated, but still its new version {1} doesn't match expected version {2}.", assetType, newSerializedVersion, expectedVersion));
                }

//.........这里部分代码省略.........
开发者ID:Powerino73,项目名称:paradox,代码行数:101,代码来源:AssetMigration.cs

示例6: Log

 protected override void Log(ILogger logger, string format, params object[] args)
 {
     logger.Verbose(format, args);
 }
开发者ID:CallWall,项目名称:CallWall.Windows,代码行数:4,代码来源:LogExtensionTests.cs

示例7: GetworkMiner

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pool"></param>
        /// <param name="minerManager"></param>
        public GetworkMiner(int id, IPool pool, IMinerManager minerManager)
        {
            Id = id; // the id of the miner.
            Pool = pool;
            _minerManager = minerManager;

            Authenticated = false; // miner has to authenticate.

            Software = MinerSoftware.Unknown;
            SoftwareVersion = new Version();

            _logger = Log.ForContext<GetworkMiner>().ForContext("Component", pool.Config.Coin.Name);
            _packetLogger = LogManager.PacketLogger.ForContext<GetworkMiner>().ForContext("Component", pool.Config.Coin.Name);

            _rpcResultHandler = callback =>
            {
                var asyncData = ((JsonRpcStateAsync) callback);
                var result = asyncData.Result;
                var response = Encoding.UTF8.GetBytes(result);
                var context = (GetworkContext) asyncData.AsyncState;

                context.Response.ContentType = "application/json";
                context.Response.ContentEncoding = Encoding.UTF8;
                context.Response.ContentLength64 = response.Length;
                context.Response.OutputStream.Write(response, 0, response.Length);

                _packetLogger.Verbose("tx: {0}", result.PrettifyJson());
            };
        }
开发者ID:carloslozano,项目名称:CoiniumServ,代码行数:35,代码来源:GetworkMiner.cs

示例8: CallService

        //private async Task<ServiceDto> CallConsul(HttpContext context, ILogger log, string serviceName)
        //{
        //    try
        //    {
        //        var data = new ServiceDto();
        //        log.Verbose("Searching service in Consul...");

        //        using (var client = new ConsulClient())
        //        {
        //            var consulCatalog = await client.Catalog.Service(serviceName);

        //            if (consulCatalog.Response.Length > 0)
        //            {
        //                var service = consulCatalog.Response[0];
        //                data.Address = IPAddress.Parse(service.Address);
        //                data.Port = service.ServicePort;

        //                log.Information("Sending request to {Host}:{port}...", service.Address, data.Port);
        //            }
        //            else
        //            {
        //                log.Warning("Service not found!");
        //                context.Response.Send(404);
        //            }
        //        }

        //        return data;
        //    }
        //    catch (Exception e)
        //    {
        //        log.Error(e, "Cannot call Consul");
        //        context.Response.Send(500);
        //        return null;
        //    }
        //}

        private static async Task CallService(HttpContext context, HttpRequest request, ILogger log, ServiceInfo serviceInfo)
        {
            IPAddress serviceAdress = IPAddress.Parse(serviceInfo.Address);
            int servicePort = serviceInfo.Port;

            using (context)
            {
                try
                {
                    using (var client = new TcpClient())
                    {
                        client.Connect(serviceAdress, servicePort);

                        using (var realService = client.GetStream())
                        {
                            log.Verbose("Sending request...");

                            await request.RedirectToAsync(realService);

                            log.Verbose("Waiting response...");

                            await context.Response.RedirectFromAsync(realService);

                            log.Information("Finished!");
                        }
                    }
                }
                catch (Exception e)
                {
                    log.Error(e, "Cannot call service");
                    context.Response.Send(500);
                }
            }
        }
开发者ID:xunilrj,项目名称:Artemis,代码行数:70,代码来源:CatalogRedirectSink.cs

示例9: FileController

 /// <summary>
 /// Initializes a new instance of the <see cref="FileController"/> class.
 /// </summary>
 /// <param name="hostingEnvironment">
 /// The hosting environment.
 /// </param>
 /// <param name="files">A list of files</param>
 public FileController(IApplicationEnvironment hostingEnvironment)
 {
     log = Log.ForContext<FileController>();
     fileUploadPath = Path.Combine(hostingEnvironment.ApplicationBasePath, "Uploads");
     log.Verbose("File handler created with base path: {@basepath}", fileUploadPath);
 }
开发者ID:j2ghz,项目名称:IntranetGJAK,代码行数:13,代码来源:FileController.cs


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