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


C# Logger.Verbose方法代码示例

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


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

示例1: CanLogMessageThroughHelpers

        public void CanLogMessageThroughHelpers()
        {
            // Arrange
            var logId = _fixture.Create<Guid>();
            string actualData = null;

            var webClientMock = new Mock<IWebClient>();
            webClientMock
                .Setup(x => x.Post(It.IsAny<WebHeaderCollection>(), It.IsAny<Uri>(), It.IsAny<string>(), It.IsAny<Func<WebHeaderCollection, string, string>>()))
                .Callback<WebHeaderCollection, Uri, string, Func<WebHeaderCollection, string, string>>((headers, uri, data, resultor) => { actualData = data; })
                .Returns(Task.FromResult(string.Empty));

            var logger = new Logger(logId, null, webClientMock.Object);

            var utcDate = DateTime.UtcNow.ToString("yyyy-MM-dd");
            var value = _fixture.Create<string>();

            // Act
            logger.Verbose("{0}", value);

            // Assert
            Assert.That(actualData, Is.Not.Null);
            Assert.That(actualData, Is.StringContaining(value));
            Assert.That(actualData, Is.StringContaining(Severity.Verbose.ToString()));
            Assert.That(actualData, Is.StringContaining(utcDate));
        }
开发者ID:kodofish,项目名称:elmah.io,代码行数:26,代码来源:LoggerTest.cs

示例2: GlobalSingleInstanceActivationMaintainer

        internal GlobalSingleInstanceActivationMaintainer(LocalGrainDirectory router, Logger logger, GlobalConfiguration config)
        {
            this.router = router;
            this.logger = logger;
            this.period = config.GlobalSingleInstanceRetryInterval;
            logger.Verbose("GSIP:M GlobalSingleInstanceActivationMaintainer Started, Period = {0}", period);

        }
开发者ID:osjimenez,项目名称:orleans,代码行数:8,代码来源:GlobalSingleInstanceActivationMaintainer.cs

示例3: Synchronize

        /// <summary>
        /// Synchronizes files to an android device.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="device">The device.</param>
        /// <param name="fileMapping">The file mapping (relative target path, source HDD filename).</param>
        /// <param name="androidPath">The android path.</param>
        /// <param name="cacheFile">The cache file.</param>
        public static void Synchronize(Logger logger, string device, Dictionary<string, string> fileMapping, string androidPath, string cacheFile)
        {
            // Ensure android path ends up with directory separator
            if (!androidPath.EndsWith("/"))
                androidPath = androidPath + "/";

            // Search files
            var currentVersions = fileMapping
                .ToDictionary(x => x.Key, x => new FileVersion(x.Value));

            // Try to read previous cache file
            var previousVersions = new Dictionary<string, FileVersion>();
            try
            {
                using (var file = File.OpenRead(cacheFile))
                {
                    var binaryReader = new BinarySerializationReader(file);
                    binaryReader.Serialize(ref previousVersions, ArchiveMode.Deserialize);
                }
            }
            catch (IOException)
            {
            }

            var filesToRemove = new List<string>();
            var filesToUpload = new List<string>();

            // Remove unecessary files (in previousVersions but not in currentVersions)
            foreach (var file in previousVersions.Where(x => !currentVersions.ContainsKey(x.Key)))
            {
                filesToRemove.Add(file.Key);
            }

            // Upload files that are either not uploaded yet, or not up to date
            foreach (var file in currentVersions)
            {
                FileVersion fileVersion;
                if (!previousVersions.TryGetValue(file.Key, out fileVersion)
                    || fileVersion.FileSize != file.Value.FileSize
                    || fileVersion.LastModifiedDate != file.Value.LastModifiedDate)
                {
                    filesToUpload.Add(file.Key);
                }
            }

            // Upload files
            foreach (var file in filesToUpload)
            {
                if (logger != null)
                    logger.Verbose("Copying file {0}", file);
                RunAdb(device, string.Format("push \"{0}\" \"{1}\"", fileMapping[file], androidPath + file.Replace('\\', '/')));
            }

            // Remove files
            foreach (var file in filesToRemove)
            {
                if (logger != null)
                    logger.Verbose("Deleting file {0}", file);
                RunAdb(device, string.Format("shell \"rm {0}\"", androidPath + file.Replace('\\', '/')));
            }

            // Write new cache file
            using (var file = File.Create(cacheFile))
            {
                var binaryWriter = new BinarySerializationWriter(file);
                binaryWriter.Write(currentVersions);
            }
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:76,代码来源:AndroidAdbUtilities.cs


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