Пример #1
0
        static public IReflectInsight Add(String name, IReflectInsight ri)
        {
            lock (FInstances)
            {
                RILogManagerNode node = GetNode(name);
                if (node != null)
                {
                    // if the RI already exists, only change the category, color, enabled state and destination binding groups
                    lock (node.Instance)
                    {
                        node.Instance.ClearDestinationBindingGroup();
                        node.Instance.Category  = ri.Category;
                        node.Instance.BackColor = ri.BackColor;
                        node.Instance.Enabled   = ri.Enabled;
                        node.Instance.DestinationBindingGroupId = ri.DestinationBindingGroupId;
                    }

                    ri.Dispose();
                    return(node.Instance);
                }

                FInstances[name] = new RILogManagerNode(name, ri);
                return(ri);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Class1"/> class.
        /// </summary>
        /// <param name="loggerFactory">The logger factory.</param>
        public Class1(ILoggerFactory loggerFactory)
        {
            // ReflectInsight.Extensions.Logger
            _logger = loggerFactory.CreateLogger <Class1>();
            _logger.LogInformation("Class1 constructor - Welcome to ReflectInsight.Extensions.Logging.");

            // ReflectInsight Logging
            _reflectInsightLog = new ReflectSoftware.Insight.ReflectInsight();
            _reflectInsightLog.SendInformation("Class1 constructor - Welcome to ReflectInsight logging.");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReflectInsightOutput" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="healthReporter">The health reporter.</param>
        public ReflectInsightOutput(IConfiguration configuration, IHealthReporter healthReporter)
        {
            Requires.NotNull(configuration, nameof(configuration));
            Requires.NotNull(healthReporter, nameof(healthReporter));

            _healthReporter = healthReporter;

            var riConfig = new ReflectInsightOutputConfiguration();

            try
            {
                configuration.Bind(riConfig);
                _reflectInsight = RILogManager.Get(riConfig.InstanceName ?? TraceTag);
            }
            catch
            {
                healthReporter.ReportProblem($"Invalid {nameof(TraceTag)} configuration encountered: '{configuration.ToString()}'", EventFlowContextIdentifiers.Configuration);
                throw;
            }
        }
Пример #4
0
 /// <summary>
 /// Sends the internal error.
 /// </summary>
 /// <param name="ri">The ri.</param>
 /// <param name="mType">Type of the m.</param>
 /// <param name="ex">The ex.</param>
 /// <returns></returns>
 static private Boolean SendInternalError(IReflectInsight ri, MessageType mType, Exception ex)
 {
     return((Boolean)FSendInternalErrorMethodInfo.Invoke(ri, new object[] { mType, ex }));
 }
Пример #5
0
 public RILogManagerNode(String name, IReflectInsight ri)
 {
     Disposed = false;
     Name     = name;
     Instance = ri;
 }