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


C# Logger.Info方法代码示例

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


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

示例1: _LoadFromFile

        private ErrorSuccess<IVsixPackage, string> _LoadFromFile(string file, Logger log, ErrorSuccessFactory<IVsixPackage, string> ef)
        {
            log.Info($"Reading {file}");

            ZipArchive zipFile;
            try
            {
                zipFile = ZipFile.OpenRead(file);
            }
            catch (Exception ex)
            {
                log.Error($"{file} is not a zip archive.", ex);
                return ef.Error($"{file} is not a zip archive: {ex.Message}");
            }

            using (zipFile)
            {
                var manifestEntry = zipFile.Entries.FirstOrDefault(entry => entry.FullName == Entry.Manifest);
                if (manifestEntry == null)
                {
                    return ef.Error($"{file} does not contain a {Entry.Manifest} entry.");
                }

                return _CreateFromZipManifest(file, manifestEntry, log, ef);
            }
        }
开发者ID:ChrisMaddock,项目名称:VSGallery.AtomGenerator,代码行数:26,代码来源:VsixPackageFactory.cs

示例2: Download

        public Download(Uri uri, string key, CookieContainer cc, JObject song)
        {
            m_uri = uri;
            m_key = key;
            m_cc = cc;
            m_song = song;

            song["Status"] = "Opening file";
            string filename = (string)song["ArtistName"] + " - " + (string)song["Name"] + ".mp3";
            m_logger = new Logger(this.GetType().ToString() + " " + filename);
            string dst = "";
            string path = "";
            if (Main.PATH.Length != 0)
                path = Main.PATH + Path.DirectorySeparatorChar;
            dst = path + filename;
            try
            {
                m_path = dst;
                m_fs = new FileStream(dst, FileMode.Create);
            }
            catch (Exception ex)
            {
                char[] invalf = Path.GetInvalidFileNameChars();
                foreach (char c in invalf)
                    filename = filename.Replace(c, '_');
                dst = path + filename;
                try
                {
                    m_path = dst;
                    m_fs = new FileStream(dst, FileMode.Create);
                }
                catch (Exception exc)
                {
                    for (int i = 0; i < dst.Length; i++)
                    {
                        if (!Char.IsLetterOrDigit(dst[i]))
                            filename = filename.Replace(dst[i], '_');
                        dst = path + filename;
                    }
                    try
                    {
                        m_path = dst;
                        m_fs = new FileStream(dst, FileMode.Create);
                    }
                    catch (Exception exc2)
                    {
                        throw new Exception("Could not save the file buddy. (" + exc2.Message + ")");
                    }
                }
            }

            m_logger.Info("Starting download");
            song["Status"] = "Starting download";
            Segment s = new Segment(uri, cc, key, 0, SEGMENT_SIZE-1, m_path);
            m_segments.Add(s);
            s.Progress += new EventHandler(s_Progress);
            s.HeadersReceived += new Segment.HeadersReceivedHandler(s_HeadersReceived);
            s.Start();
            m_start = DateTime.Now;
        }
开发者ID:engina,项目名称:SharkIT,代码行数:60,代码来源:Download.cs

示例3: VirtualBucketsRingProvider

        private List<Tuple<uint, SiloAddress>> sortedBucketsList; // flattened sorted bucket list for fast lock-free calculation of CalculateTargetSilo

        #endregion Fields

        #region Constructors

        internal VirtualBucketsRingProvider(SiloAddress siloAddr, int nBucketsPerSilo)
        {
            if (nBucketsPerSilo <= 0 )
                throw new IndexOutOfRangeException("numBucketsPerSilo is out of the range. numBucketsPerSilo = " + nBucketsPerSilo);

            logger = LogManager.GetLogger(typeof(VirtualBucketsRingProvider).Name);

            statusListeners = new List<IRingRangeListener>();
            bucketsMap = new SortedDictionary<uint, SiloAddress>();
            sortedBucketsList = new List<Tuple<uint, SiloAddress>>();
            myAddress = siloAddr;
            numBucketsPerSilo = nBucketsPerSilo;
            lockable = new object();
            running = true;
            myRange = RangeFactory.CreateFullRange();

            logger.Info("Starting {0} on silo {1}.", typeof(VirtualBucketsRingProvider).Name, siloAddr.ToStringWithHashCode());

            StringValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_RING, ToString);
            IntValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_RINGSIZE, () => GetRingSize());
            StringValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_MYRANGE_RINGDISTANCE, () => String.Format("x{0,8:X8}", ((IRingRangeInternal)myRange).RangeSize()));
            FloatValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_MYRANGE_RINGPERCENTAGE, () => (float)((IRingRangeInternal)myRange).RangePercentage());
            FloatValueStatistic.FindOrCreate(StatisticNames.CONSISTENTRING_AVERAGERINGPERCENTAGE, () =>
            {
                int size = GetRingSize();
                return size == 0 ? 0 : ((float)100.0/(float) size);
            });

            // add myself to the list of members
            AddServer(myAddress);
        }
开发者ID:Rejendo,项目名称:orleans,代码行数:37,代码来源:VirtualBucketsRingProvider.cs

示例4: Main

        static void Main(string[] args)
        {
            ILayout simpleLayout = new SimpleLayout();
            IAppender consoleAppender = new ConsoleAppender(simpleLayout);
            ILogger logger = new Logger(consoleAppender);

            logger.Error("Error parsing JSON");
            logger.Info(string.Format("User {0} successfully registered.", "Pesho"));

            Console.WriteLine(new string('-', 20));

            //We create a second Appender and add it to the existing ILogger object
            IFileAppender fileAppender = new FileAppender(simpleLayout);
            fileAppender.File = "log.txt";

            logger.AddAppender(fileAppender);

            logger.Fatal("mscorlib.dll does not respond");
            logger.Critical("No connection string found in App.config");

            Console.WriteLine(new string('-', 20));

            //We set the new XML Layout on each Appender that the Logger object uses
            foreach (IAppender appender in logger.Appenders)
            {
                appender.Layout = new XmlLayout();
            }

            logger.Fatal("mscorlib.dll does not respond");
            logger.Critical("No connection string found in App.config");

            Console.WriteLine(new string('-', 20));

            //We set the Report Level Minimum at Error
            foreach (IAppender appender in logger.Appenders)
            {
                appender.ReportLevelMinimum = Enums.ReportLevel.Error;
            }

            logger.Info("Everything seems fine");
            logger.Warning("Warning: ping is too high - disconnect imminent");
            logger.Error("Error parsing request");
            logger.Critical("No connection string found in App.config");
            logger.Fatal("mscorlib.dll does not respond");

            Console.WriteLine(new string('-', 20));
        }
开发者ID:mgulubov,项目名称:Homework-SOLIDPrinciplesInSoftwareDesign,代码行数:47,代码来源:ProblemLogger.cs

示例5: OnActivateAsync

 public override Task OnActivateAsync()
 {
     logger = LogManager.GetLogger(String.Format("GrainBasedReminderTable_{0}", Data.Address.ToString()), LoggerType.Runtime);
     logger.Info("GrainBasedReminderTable {0} Activated. Full identity: {1}", Identity, Data.Address.ToFullString());
     remTable = new InMemoryRemindersTable();
     base.DelayDeactivation(TimeSpan.FromDays(10 * 365)); // Delay Deactivation for GrainBasedReminderTable virtually indefinitely.
     return TaskDone.Done;
 }
开发者ID:Rejendo,项目名称:orleans,代码行数:8,代码来源:GrainBasedReminderTable.cs

示例6: ExampleOne

        private static void ExampleOne()
        {
            ILayout simpleLayout = new SimpleLayout();
            IAppender consoleAppender =
                 new ConsoleAppender(simpleLayout);
            ILogger logger = new Logger(consoleAppender);

            logger.Error("Error parsing JSON.");
            logger.Info(string.Format("User {0} successfully registered.", "Pesho"));
        }
开发者ID:nok32,项目名称:SoftUny-HW,代码行数:10,代码来源:Program.cs

示例7: Initialize

        public async Task Initialize(Guid serviceid, string connectionstring)
        {
            Name = "AzureTableBasedGossipChannel-" + ++sequenceNumber;
            logger = LogManager.GetLogger(Name, LoggerType.Runtime);

            logger.Info("Initializing Gossip Channel for ServiceId={0} using connection: {1}, SeverityLevel={2}",
                serviceid, ConfigUtilities.RedactConnectionStringInfo(connectionstring), logger.SeverityLevel);

            tableManager = await GossipTableInstanceManager.GetManager(serviceid, connectionstring, logger);
        }
开发者ID:caomw,项目名称:orleans,代码行数:10,代码来源:AzureTableBasedGossipChannel.cs

示例8: _CreateFromZipManifest

        private ErrorSuccess<IVsixPackage, string> _CreateFromZipManifest(string file, ZipArchiveEntry manifestEntry, Logger log, ErrorSuccessFactory<IVsixPackage, string> ef)
        {
            var packageManifest = _TryGetPackageManifest(manifestEntry);
            var vsixManifest = _TryGetVsixManifest(manifestEntry);

            if (packageManifest != null)
            {
                log.Info("Loaded PackageManifest based manifest");
                return ef.Success(new VsixWithPackageManifest(file, packageManifest));
            }

            if (vsixManifest != null)
            {
                log.Info("Loaded Vsix based manifest");
                return ef.Success(new VsixWithVsixManifest(file, vsixManifest));
            }

            return ef.Error($"{file}\\{Entry.Manifest} is not a valid package manifest file.");
        }
开发者ID:ChrisMaddock,项目名称:VSGallery.AtomGenerator,代码行数:19,代码来源:VsixPackageFactory.cs

示例9: _AddPackages

        private static void _AddPackages(Uri root, string imageRoot, IEnumerable<IVsixPackage> packages, SyndicationFeed feed, Logger log)
        {
            // See https://msdn.microsoft.com/en-us/library/hh266717.aspx

            var items = new List<SyndicationItem>();
            feed.Items = items;

            var orderedPackages = packages
                .OrderBy(pkg => pkg.DisplayName)
                .ThenBy(pkg => pkg.Id);

            foreach (var pkg in orderedPackages)
            {
                log.Info($"Adding package {pkg.DisplayName} ({pkg.Id}) to feed");

                var item = new SyndicationItem();
                item.Id = pkg.Id;
                item.Title = new TextSyndicationContent(pkg.DisplayName);
                item.Summary = new TextSyndicationContent(pkg.Description);
                item.PublishDate = new DateTimeOffset(File.GetLastWriteTimeUtc(pkg.File));
                item.LastUpdatedTime = new DateTimeOffset(File.GetLastWriteTimeUtc(pkg.File));
                item.Authors.Add(new SyndicationPerson { Name = pkg.Publisher });
                item.Content = SyndicationContent.CreateUrlContent(root.MakeRelativeUri(new Uri(pkg.File)), "application/octet-stream");

                _AddPreviewImages(root, imageRoot, item, pkg, log);

                var ns = XNamespace.Get("http://schemas.microsoft.com/developer/vsx-syndication-schema/2010");
                var xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance");
                var content = new XElement(
                    ns + "Vsix",
                    new XAttribute(XNamespace.Xmlns + "xsi", xsi),
                    new XElement(ns + "Id", pkg.Id),
                    new XElement(ns + "Version", pkg.Version),
                    new XElement(ns + "References"),
                    new XElement(
                        ns + "Rating",
                        new XAttribute(xsi + "nil", "true")),
                    new XElement(
                        ns + "RatingCount",
                        new XAttribute(xsi + "nil", "true")),
                    new XElement(
                        ns + "DownloadCount",
                        new XAttribute(xsi + "nil", "true")));

                using (var stringReader = new StringReader(content.ToString()))
                using (var reader = XmlReader.Create(stringReader))
                {
                    item.ElementExtensions.Add(reader);
                }

                items.Add(item);
            }
        }
开发者ID:ChrisMaddock,项目名称:VSGallery.AtomGenerator,代码行数:53,代码来源:FeedBuilder.cs

示例10: ExampleTwo

        private static void ExampleTwo()
        {
            var simpleLayout = new SimpleLayout();

            var consoleAppender = new ConsoleAppender(simpleLayout);
            var fileAppender = new FileAppender(simpleLayout);
            fileAppender.File = "log.txt";

            var logger = new Logger(consoleAppender, fileAppender);
            logger.Error("Error parsing JSON.");
            logger.Info(string.Format("User {0} successfully registered.", "Pesho"));
            logger.Warn("Warning - missing files.");
        }
开发者ID:nok32,项目名称:SoftUny-HW,代码行数:13,代码来源:Program.cs

示例11: ExampleFour

        private static void ExampleFour()
        {
            var simpleLayout = new SimpleLayout();
            var consoleAppender = new ConsoleAppender(simpleLayout);
            consoleAppender.ReportLevel = ReportLevel.Error;

            var logger = new Logger(consoleAppender);

            logger.Info("Everything seems fine");
            logger.Warn("Warning: ping is too high - disconnect imminent");
            logger.Error("Error parsing request");
            logger.Critical("No connection string found in App.config");
            logger.Fatal("mscorlib.dll does not respond");
        }
开发者ID:nok32,项目名称:SoftUny-HW,代码行数:14,代码来源:Program.cs

示例12: Launch

 public int Launch()
 {
     CommonOptions commonOptions = _modeRunner.CommonOptions;
     IDirectoryLocation outFolder = commonOptions.OutputDirectory;
     var log = outFolder.GetFileLocation("CanvasLog.txt");
     var error = outFolder.GetFileLocation("CanvasError.txt");
     using (ILogger logger = new Logger(log, error))
     {
         try
         {
             logger.Info($"Running Canvas {_mode} {_version}");
             logger.Info($"Command-line arguments: {string.Join(" ", _args)}");
             var checkpointRunner =
                 GetCheckpointRunner(
                     logger,
                     outFolder,
                     commonOptions.StartCheckpoint,
                     commonOptions.StopCheckpoint,
                     commonOptions.WholeGenomeFasta);
             using (var manager = checkpointRunner.Manager)
             {
                 IDirectoryLocation loggingFolder = outFolder.CreateSubdirectory("Logging");
                 IsasConfiguration config = IsasConfiguration.GetConfiguration();
                 IWorkManager workManager = new LocalWorkManager(logger, loggingFolder, 0, config.MaximumMemoryGB, config.MaximumHoursPerProcess);
                 _modeRunner.Run(logger, checkpointRunner, workManager);
                 manager.CheckFinalState();
             }
         }
         catch (StopCheckpointFoundException) { }
         catch (Exception e)
         {
             logger.Error($"Canvas workflow error: {e}");
             return -1;
         }
     }
     return 0;
 }
开发者ID:Illumina,项目名称:canvas,代码行数:37,代码来源:ModeLauncher.cs

示例13: Error

		public void Error()
		{
			// arrange
			var logger = new Logger();
			var logs = new StringBuilder();
			logger.SetWriter(new StringWriter(logs));
			logger.AddCategory("error");

			// act
			logger.Debug("debug message");
			logger.Info("info message");
			logger.Error("error message");

			// assert
			Assert.Equal("error message", logs.ToString().Trim());
		}
开发者ID:gitter-badger,项目名称:vika,代码行数:16,代码来源:LoggerTest.cs

示例14: InitializeMembershipTable

 public Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, Logger log)
 {
     logger = log;
     deploymentId = config.DeploymentId;
     storage = new DynamoDBStorage(config.DataConnectionString, log);
     logger.Info(ErrorCode.MembershipBase, "Initializing AWS DynamoDB Membership Table");
     return storage.InitializeTable(TABLE_NAME_DEFAULT_VALUE,
         new List<KeySchemaElement>
         {
             new KeySchemaElement { AttributeName = SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME, KeyType = KeyType.HASH },
             new KeySchemaElement { AttributeName = SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME, KeyType = KeyType.RANGE }
         },
         new List<AttributeDefinition>
         {
             new AttributeDefinition { AttributeName = SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME, AttributeType = ScalarAttributeType.S },
             new AttributeDefinition { AttributeName = SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME, AttributeType = ScalarAttributeType.S }
         });
 }
开发者ID:osjimenez,项目名称:orleans,代码行数:18,代码来源:DynamoDBMembershipTable.cs

示例15: InitializeMembershipTable

        public async Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, Logger log)
        {
            logger = log;
            AzureTableDefaultPolicies.MaxBusyRetries = config.MaxStorageBusyRetries;
            LogFormatter.SetExceptionDecoder(typeof(StorageException), AzureStorageUtils.PrintStorageException);

            tableManager = await OrleansSiloInstanceManager.GetManager(
                config.DeploymentId, config.DataConnectionString);

            // even if I am not the one who created the table, 
            // try to insert an initial table version if it is not already there,
            // so we always have a first table version row, before this silo starts working.
            if (tryInitTableVersion)
            {
                // ignore return value, since we don't care if I inserted it or not, as long as it is in there. 
                bool created = await tableManager.TryCreateTableVersionEntryAsync();
                if(created) logger.Info("Created new table version row.");
            }
        }
开发者ID:Rejendo,项目名称:orleans,代码行数:19,代码来源:AzureBasedMembershipTable.cs


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