コード例 #1
0
 private void TrySetupLogging()
 {
     try
     {
         m_log = new LogSubscriber(m_logger, m_hMediaLib);
     }
     catch (EntryPointNotFoundException ex)
     {
         string name       = ex.TargetSite.Name;
         string minVersion = MiscUtils.GetMinimalSupportedVersion(ex);
         if (!string.IsNullOrEmpty(minVersion))
         {
             string msg = string.Format("libVLC logging functinality enabled staring libVLC version {0} while you are using version {1}", minVersion, Version);
             m_logger.Warning(msg);
         }
         else
         {
             m_logger.Warning(ex.Message);
         }
     }
     catch (Exception ex)
     {
         string msg = string.Format("Failed to setup logging, reason : {0}", ex.Message);
         m_logger.Error(msg);
     }
 }
コード例 #2
0
        /// <summary>
        /// Creates a new <see cref="ServiceHost"/> instance.
        /// </summary>
        public ServiceHost()
        {
            ServiceName = "openHistorian";

            m_logSubscriber = Logger.CreateSubscriber();
            m_logSubscriber.SubscribeToAssembly(typeof(Number).Assembly, VerboseLevel.High);
            m_logSubscriber.SubscribeToAssembly(typeof(HistorianKey).Assembly, VerboseLevel.High);
            m_logSubscriber.NewLogMessage += m_logSubscriber_Log;

            try
            {
                // Assign default minification exclusion early (well before web server static initialization)
                CategorizedSettingsElementCollection systemSettings = ConfigurationFile.Current.Settings["systemSettings"];
                systemSettings.Add("MinifyJavascriptExclusionExpression", DefaultMinifyJavascriptExclusionExpression, "Defines the regular expression that will exclude Javascript files from being minified. Empty value will target all files for minification.");

                if (string.IsNullOrWhiteSpace(systemSettings["MinifyJavascriptExclusionExpression"].Value))
                {
                    systemSettings["MinifyJavascriptExclusionExpression"].Value = DefaultMinifyJavascriptExclusionExpression;
                }
            }
            catch (Exception ex)
            {
                Logger.SwallowException(ex);
            }

            // This function needs to be called before establishing time-series IaonSession
            SetupGrafanaHostingAdapter();
        }
コード例 #3
0
            protected virtual void Dispose(bool disposing)
            {
                if (!m_disposed)
                {
                    try
                    {
                        if ((object)m_server != null)
                        {
                            m_server.Dispose();
                            m_server = null;
                        }

                        if ((object)m_logSubscriber != null)
                        {
                            m_logSubscriber.NewLogMessage -= m_logSubscriber_Log;
                            m_logSubscriber = null;
                        }

                        m_parent.ShowUpdateMessage("[SnapDB] Engine terminated");
                        {
                        }
                    }
                    finally
                    {
                        m_disposed = true;  // Prevent duplicate dispose.
                    }
                }
            }
コード例 #4
0
        /// <summary>
        /// Creates a new <see cref="ServiceHost"/> instance.
        /// </summary>
        public ServiceHost()
        {
            ServiceName = "openHistorian";

            m_logSubscriber = Logger.CreateSubscriber();
            m_logSubscriber.SubscribeToAssembly(typeof(Number).Assembly, VerboseLevel.High);
            m_logSubscriber.SubscribeToAssembly(typeof(HistorianKey).Assembly, VerboseLevel.High);
            m_logSubscriber.NewLogMessage += m_logSubscriber_Log;
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: JenBytowski/rabbitmq-test
        static void Main(string[] args)
        {
            //var sub = new BaseSubscriber(queue: "stringQueue", exchanger: "stringMessageExchanger");
            //sub.GetMessage();

            var loggerSub = new LogSubscriber(queue: "logQueue", exchanger: "log", routingKey: args[0]);

            loggerSub.GetMessage();
        }
コード例 #6
0
 public PipelineConfiguration(CustomerSubscriber customer, CustomerPublisher customerPub, SiteSubscriber site, SitePublisher sitePub, TransactionRegistration transaction, LogSubscriber logSubscriber)
 {
     this.customerSubscriber                   = customer;
     this.customerPublisher                    = customerPub;
     this.siteSubscriber                       = site;
     this.sitePublisher                        = sitePub;
     this.transactionRegistration              = transaction;
     this.siteSubscriber.SitePublisher         = this.sitePublisher;
     this.customerSubscriber.CustomerPublisher = this.customerPublisher;
     this.LogSubscriber                        = logSubscriber;
 }
コード例 #7
0
        /// <summary>
        /// Creates a new <see cref="ServiceHost"/> instance.
        /// </summary>
        public ServiceHost()
        {
            ServiceName = "openHistorian";

            m_logSubscriber = Logger.CreateSubscriber();
            m_logSubscriber.SubscribeToAssembly(typeof(Number).Assembly, VerboseLevel.High);
            m_logSubscriber.SubscribeToAssembly(typeof(HistorianKey).Assembly, VerboseLevel.High);
            m_logSubscriber.NewLogMessage += m_logSubscriber_Log;

            // This function needs to be called before establishing time-series IaonSession
            SetupGrafanaHostingAdapter();
        }
コード例 #8
0
        public void Example1()
        {
            LogSubscriber subscriber = Logger.CreateSubscriber(VerboseLevel.All);

            subscriber.NewLogMessage += subscriber_Log;
            RootClass c = new RootClass();

            c.A.WriteMessage();
            c.B.WriteMessage();
            c.C.WriteMessage();
            c.WriteMessage();
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (m_log != null)
            {
                m_log.Dispose();
                m_log = null;
            }
            if (m_vlm != null)
            {
                m_vlm.Dispose();
                m_vlm = null;
            }

            if (disposing)
            {
                AppDomain.CurrentDomain.UnhandledException -= CurrentDomain_UnhandledException;
            }

            Release();
        }
コード例 #10
0
 private void TrySetupLogging()
 {
     try
     {
         m_log = new LogSubscriber(m_logger);
     }
     catch (EntryPointNotFoundException ex)
     {
         MinimalLibVlcVersion minVersion = (MinimalLibVlcVersion)Attribute.GetCustomAttribute(ex.TargetSite, typeof(MinimalLibVlcVersion));
         if (minVersion != null)
         {
             string msg = string.Format("libVLC logging functinality enabled staring libVLC version {0} while you are using version {1}", minVersion.MinimalVersion, Version);
             m_logger.Warning(msg);
         }
     }
     catch (Exception ex)
     {
         string msg = string.Format("Failed to setup logging, reason : {0}", ex.Message);
         m_logger.Error(msg);
     }
 }
コード例 #11
0
            public SnapDBEngine(MigrationUtility parent, string instanceName, string destinationFilesLocation, string targetFileSize, string directoryNamingMethod, bool readOnly = false)
            {
                m_parent = parent;

                m_logSubscriber = Logger.CreateSubscriber(VerboseLevel.High);
                m_logSubscriber.NewLogMessage += m_logSubscriber_Log;

                if (string.IsNullOrEmpty(instanceName))
                {
                    instanceName = "PPA";
                }
                else
                {
                    instanceName = instanceName.Trim();
                }

                // Establish archive information for this historian instance
                HistorianServerDatabaseConfig archiveInfo = new HistorianServerDatabaseConfig(instanceName, destinationFilesLocation, !readOnly);

                double targetSize;

                if (!double.TryParse(targetFileSize, out targetSize))
                {
                    targetSize = 1.5D;
                }

                archiveInfo.TargetFileSize = (long)(targetSize * SI.Giga);

                int methodIndex;

                if (!int.TryParse(directoryNamingMethod, out methodIndex) || !Enum.IsDefined(typeof(ArchiveDirectoryMethod), methodIndex))
                {
                    methodIndex = (int)ArchiveDirectoryMethod.YearThenMonth;
                }

                archiveInfo.DirectoryMethod = (ArchiveDirectoryMethod)methodIndex;

                m_server = new HistorianServer(archiveInfo);
                m_parent.ShowUpdateMessage("[SnapDB] Engine initialized");
            }
コード例 #12
0
ファイル: Program.cs プロジェクト: daeer73/EventExperiment
        private static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.Console()
                         .WriteTo.File(@"\Logs\EventExperiment.csv",
                                       rollingInterval: RollingInterval.Day,
                                       outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} ; [{Level:u3}] ; {Message:lj} ;{NewLine}{Exception};")
                         .CreateLogger();

            var logSub      = new LogSubscriber(Log.Logger);
            var customer    = new CustomerSubscriber();
            var customerPub = new CustomerPublisher();
            var site        = new SiteSubscriber();
            var sitePub     = new SitePublisher();
            var trans       = new TransactionRegistration();

            var configuration = new PipelineConfiguration(customer, customerPub, site, sitePub, trans, logSub)
                                .RegisterSiteSubscriptions()
                                .RegisterSitePublications()
                                .RegisterCustomerSubscriptions()
                                .RegisterCustomerPublications();

            var stopWatch = new Stopwatch();

            stopWatch.Start();

            Parallel.For(1, 1000, (x) => { trans.TransactionReceivedEvent(x, Guid.NewGuid()); });

            stopWatch.Stop();
            Log.Information($"Elapsed Time (Milliseconds): {stopWatch.ElapsedMilliseconds}.");

            Console.WriteLine("Press any key to continue.");
            Log.CloseAndFlush();
            Console.ReadKey();
        }