• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TraceLogger类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: OnActivateAsync

 public override Task OnActivateAsync()
 {
     logger = TraceLogger.GetLogger("GrainBasedMembershipTable", TraceLogger.LoggerType.Runtime);
     logger.Info(ErrorCode.MembershipGrainBasedTable1, "GrainBasedMembershipTable Activated.");
     table = new InMemoryMembershipTable();
     return TaskDone.Done;
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:7,代码来源:GrainBasedMembershipTable.cs


示例2: AzureGossipTableTests

        private AzureTableBasedGossipChannel gossipTable; // This type is internal

        public AzureGossipTableTests()
        {
            logger = TraceLogger.GetLogger("AzureGossipTableTests", TraceLogger.LoggerType.Application);
        
            globalServiceId = Guid.NewGuid();
            deploymentId = "test-" + globalServiceId;

            IPAddress ip;
            if (!IPAddress.TryParse("127.0.0.1", out ip))
            {
                logger.Error(-1, "Could not parse ip address");
                return;
            }
            IPEndPoint ep1 = new IPEndPoint(ip, 21111);
            siloAddress1 = SiloAddress.New(ep1, 0);
            IPEndPoint ep2 = new IPEndPoint(ip, 21112);
            siloAddress2 = SiloAddress.New(ep2, 0);

            logger.Info("DeploymentId={0}", deploymentId);

            GlobalConfiguration config = new GlobalConfiguration
            {
                ServiceId = globalServiceId,
                ClusterId = "0",
                DeploymentId = deploymentId,
                DataConnectionString = StorageTestConstants.DataConnectionString
            };

            gossipTable = new AzureTableBasedGossipChannel();
            var done = gossipTable.Initialize(config.ServiceId, config.DataConnectionString);
            if (!done.Wait(timeout))
            {
                throw new TimeoutException("Could not create/read table.");
            }
        }
开发者ID:gaoshoufenmu,项目名称:orleans,代码行数:37,代码来源:AzureGossipTableTests.cs


示例3: Load

        /// <summary>
        /// Load this configuratin from xml element.
        /// </summary>
        /// <param name="xmlElement"></param>
        /// <param name="logger"></param>
        public void Load(XmlElement xmlElement, TraceLogger logger)
        {
            bool found = false;
            foreach (XmlNode node in xmlElement.ChildNodes)
            {
                found = true;
                var config = GrainTypeConfiguration.Load((XmlElement)node, logger);
                if (null == config) continue;

                if (config.AreDefaults)
                {
                    defaults = config;
                }
                else
                {
                    if (classSpecific.ContainsKey(config.FullTypeName))
                    {
                        throw new InvalidOperationException(string.Format("duplicate type {0} in configuration", config.FullTypeName));
                    }
                    classSpecific.Add(config.FullTypeName, config);
                }
            }

            if (!found)
            {
                throw new InvalidOperationException("empty GrainTypeConfiguration element");
            }
        }
开发者ID:sbambach,项目名称:orleans,代码行数:33,代码来源:ApplicationConfiguration.cs


示例4: Watchdog

 public Watchdog(TimeSpan watchdogPeriod, List<IHealthCheckParticipant> watchables)
 {
     logger = TraceLogger.GetLogger("Watchdog");
     healthCheckPeriod = watchdogPeriod;
     participants = watchables;
     watchdogChecks = CounterStatistic.FindOrCreate(StatisticNames.WATCHDOG_NUM_HEALTH_CHECKS);
 }
开发者ID:stanroze,项目名称:orleans,代码行数:7,代码来源:Watchdog.cs


示例5: Log

        public void Log(            
            Logger.Severity severity,
            TraceLogger.LoggerType loggerType,
            string caller,
            string message,
            IPEndPoint myIPEndPoint,
            Exception exception,
            int errorCode)    
        {
            var now = DateTime.UtcNow;

            var msg = FormatLogMessage(
                now,
                severity,
                loggerType,
                caller,
                message,
                myIPEndPoint,
                exception,
                errorCode);

            try
            {
                WriteLogMessage(msg, severity);
            }
            catch (Exception exc)
            {
                Trace.TraceError("Error writing log message {0} -- Exception={1}", msg, exc);
            }
        }
开发者ID:stanroze,项目名称:orleans,代码行数:30,代码来源:LogWriters.cs


示例6: AzureQueueDataManagerTests

 public AzureQueueDataManagerTests()
 {
     ClientConfiguration config = new ClientConfiguration();
     config.TraceFilePattern = null;
     TraceLogger.Initialize(config);
     logger = TraceLogger.GetLogger("AzureQueueDataManagerTests", TraceLogger.LoggerType.Application);
 }
开发者ID:stanroze,项目名称:orleans,代码行数:7,代码来源:AzureQueueDataManagerTests.cs


示例7: MultipleStreamsTestRunner

 public MultipleStreamsTestRunner(string streamProvider, int testNum = 0, bool fullTest = true)
 {
     this.streamProviderName = streamProvider;
     this.logger = TraceLogger.GetLogger("MultipleStreamsTestRunner", TraceLogger.LoggerType.Application);
     this.testNumber = testNum;
     this.runFullTest = fullTest;
 }
开发者ID:danieldeb,项目名称:orleans,代码行数:7,代码来源:MultipleStreamsTestRunner.cs


示例8: StartSimulator

        static void StartSimulator()
        {
            // Dependencies to inject into the Bulk Device Tester
            var logger = new TraceLogger();
            var configProvider = new ConfigurationProvider();
            var telemetryFactory = new EngineTelemetryFactory(logger, configProvider);

            var serializer = new JsonSerialize();
            var transportFactory = new IotHubTransportFactory(serializer, logger, configProvider);

            IVirtualDeviceStorage deviceStorage = null;
            var useConfigforDeviceList = Convert.ToBoolean(configProvider.GetConfigurationSettingValueOrDefault("UseConfigForDeviceList", "False"), CultureInfo.InvariantCulture);

            if (useConfigforDeviceList)
            {
                deviceStorage = new AppConfigRepository(configProvider, logger);
            }
            else
            {
                deviceStorage = new VirtualDeviceTableStorage(configProvider);
            }

            IDeviceFactory deviceFactory = new EngineDeviceFactory();

            // Start Simulator
            Trace.TraceInformation("Starting Simulator");
            var tester = new BulkDeviceTester(transportFactory, logger, configProvider, telemetryFactory, deviceFactory, deviceStorage);
            Task.Run(() => tester.ProcessDevicesAsync(cancellationTokenSource.Token), cancellationTokenSource.Token);
        }
开发者ID:magoroku15,项目名称:azure-iot-predictive-maintenance,代码行数:29,代码来源:Program.cs


示例9: RemoteGrainDirectory

        private static readonly TimeSpan RETRY_DELAY = TimeSpan.FromSeconds(5); // Pause 5 seconds between forwards to let the membership directory settle down

        internal RemoteGrainDirectory(LocalGrainDirectory r, GrainId id)
            : base(id, r.MyAddress)
        {
            router = r;
            partition = r.DirectoryPartition;
            logger = TraceLogger.GetLogger("Orleans.GrainDirectory.CacheValidator", TraceLogger.LoggerType.Runtime);
        }
开发者ID:mellodev,项目名称:orleans,代码行数:9,代码来源:RemoteGrainDirectory.cs


示例10: InitializeMembershipTable

        public async Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, TraceLogger traceLogger)
        {
            logger = traceLogger;
            deploymentId = config.DeploymentId;

            if (logger.IsVerbose3) logger.Verbose3("SqlMembershipTable.InitializeMembershipTable called.");

            database = RelationalStorageUtilities.CreateGenericStorageInstance(config.AdoInvariant, config.DataConnectionString);

            //This initializes all of Orleans operational queries from the database using a well known view
            //and assumes the database with appropriate defintions exists already.
            queryConstants = await database.InitializeOrleansQueriesAsync();

            // 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)
            {
                var wasCreated = await InitTableAsync();
                if(wasCreated)
                {
                    logger.Info("Created new table version row.");
                }
            }
        }
开发者ID:sGussPlasmd,项目名称:orleans,代码行数:25,代码来源:SqlMembershipTable.cs


示例11: InitializeGatewayListProvider

 public Task InitializeGatewayListProvider(ClientConfiguration config, TraceLogger traceLogger)
 {
     deploymentId = config.DeploymentId;
     connectionString = config.DataConnectionString;
     maxStaleness = config.GatewayListRefreshPeriod;
     return TaskDone.Done;
 }
开发者ID:stanroze,项目名称:orleans,代码行数:7,代码来源:SqlMembershipTable.cs


示例12: AsynchAgent

        protected AsynchAgent(string nameSuffix)
        {
            Cts = new CancellationTokenSource();
            var thisType = GetType();
            
            type = thisType.Namespace + "." + thisType.Name;
            if (type.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                type = type.Substring(8);
            }
            if (!string.IsNullOrEmpty(nameSuffix))
            {
                Name = type + "/" + nameSuffix;
            }
            else
            {
                Name = type;
            }

            Lockable = new object();
            State = ThreadState.Unstarted;
            OnFault = FaultBehavior.IgnoreFault;
            Log = TraceLogger.GetLogger(Name, TraceLogger.LoggerType.Runtime);
            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;

#if TRACK_DETAILED_STATS
            if (StatisticsCollector.CollectThreadTimeTrackingStats)
            {
                threadTracking = new ThreadTrackingStatistic(Name);
            }
#endif
            t = new Thread(AgentThreadProc) { IsBackground = true, Name = this.Name };
        }
开发者ID:sbambach,项目名称:orleans,代码行数:33,代码来源:AsynchAgent.cs


示例13: VirtualBucketsRingProvider

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

            logger = TraceLogger.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:stanroze,项目名称:orleans,代码行数:31,代码来源:VirtualBucketsRingProvider.cs


示例14: Init

 public async Task Init(GlobalConfiguration config, TraceLogger logger)
 {
     serviceId = config.ServiceId.ToString();
     deploymentId = config.DeploymentId;
     database = RelationalStorageUtilities.CreateGenericStorageInstance(config.AdoInvariantForReminders,
         config.DataConnectionStringForReminders);
     queryConstants = await database.InitializeOrleansQueriesAsync();
 }
开发者ID:JackWangCUMT,项目名称:orleans,代码行数:8,代码来源:SqlReminderTable.cs


示例15: OnActivateAsync

 public override Task OnActivateAsync()
 {
     logger = (TraceLogger)this.GetLogger("TimerGrain_" + base.Data.Address.ToString());
     context = RuntimeContext.Current.ActivationContext;
     defaultTimer = this.RegisterTimer(Tick, DefaultTimerName, TimeSpan.Zero, period);
     allTimers = new Dictionary<string, IDisposable>();
     return TaskDone.Done;
 }
开发者ID:sbambach,项目名称:orleans,代码行数:8,代码来源:TimerGrain.cs


示例16: TECControl

 public TECControl(string comPort, bool traceEnabled)
 {
     tecComPort = new SerialPort(comPort, baudrate, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
     rxBuf = new byte[rxBufferSize];
     tectl = new TraceLogger("", "tec_cam85_v02");
     tectl.Enabled = traceEnabled;
     tectl.LogMessage("TECControl", "Initialization finished");
 }
开发者ID:vakulenko,项目名称:CAM8_software,代码行数:8,代码来源:Driver.cs


示例17: TestInitialize

        public void TestInitialize()
        {
            log = TraceLogger.GetLogger(GetType().Name, TraceLogger.LoggerType.Application);

            ServiceId = Guid.NewGuid();

            UnitTestSiloHost.ConfigureClientThreadPoolSettingsForStorageTests(1000);
        }
开发者ID:sbambach,项目名称:orleans,代码行数:8,代码来源:ReminderTests_Azure_Standalone.cs


示例18: OnActivateAsync

 public override Task OnActivateAsync()
 {
     logger = TraceLogger.GetLogger(String.Format("GrainBasedReminderTable_{0}", Data.Address.ToString()), TraceLogger.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:PaulNorth,项目名称:orleans,代码行数:8,代码来源:GrainBasedReminderTable.cs


示例19: SingleStreamTestRunner

 public SingleStreamTestRunner(string streamProvider, int testNum = 0, bool fullTest = true)
 {
     this.streamProviderName = streamProvider;
     this.logger = TraceLogger.GetLogger("SingleStreamTestRunner", TraceLogger.LoggerType.Application);
     this.testNumber = testNum;
     this.runFullTest = fullTest;
     this.random = TestConstants.random;
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:8,代码来源:SingleStreamTestRunner.cs


示例20: GrainDirectoryHandoffManager

 internal GrainDirectoryHandoffManager(LocalGrainDirectory localDirectory, GlobalConfiguration config)
 {
     logger = TraceLogger.GetLogger(this.GetType().FullName);
     this.localDirectory = localDirectory;
     directoryPartitionsMap = new Dictionary<SiloAddress, GrainDirectoryPartition>();
     silosHoldingMyPartition = new List<SiloAddress>();
     lastPromise = new Dictionary<SiloAddress, Task>();
 }
开发者ID:sbambach,项目名称:orleans,代码行数:8,代码来源:GrainDirectoryHandoffManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TraceOptions类代码示例发布时间:2022-05-24
下一篇:
C# TraceLevel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap