Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TraceSourceSetting"/> class.
        /// </summary>
        /// <param name="sourceName">Name of the source.</param>
        /// <param name="loggingLevel">The logging level.</param>
        public TraceSourceSetting(string sourceName, SourceLevels loggingLevel)
        {
            Guard.NotNullOrEmpty(() => sourceName, sourceName);

            this.SourceName = sourceName;
            this.LoggingLevel = loggingLevel;
        }
Esempio n. 2
0
		internal TraceManager()
		{
			this.defaultLogFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Microsoft\\Care Suite\\Windows Device Recovery Tool\\Traces\\";
			this.currentTracingLevel = SourceLevels.All;
			this.Tracers = new List<IThreadSafeTracer>();
			AppDomain.CurrentDomain.ProcessExit += new EventHandler(this.OnCurrentDomainProcessExit);
		}
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogSourceData"/> class with the specified parameters.
 /// </summary>
 /// <param name="name">The name for the log source.</param>
 /// <param name="level">The level for the log source.</param>
 /// <param name="autoFlush"><see langword="true"/> to enable auto-flush; otherwise, <see langword="false"/>.</param>
 /// <param name="traceListeners">One or more <see cref="TraceListener"/> objects.</param>
 public LogSourceData(string name, SourceLevels level, bool autoFlush, params TraceListener[] traceListeners)
 {
     this.Name = name;
     this.Level = level;
     this.AutoFlush = autoFlush;
     this.Listeners = traceListeners.ToList();
 }
Esempio n. 4
0
 LoggingLevel(string name, int index, SourceLevels sourceLevel, TraceEventType traceEventType)
 {
     _name = name;
     _index = index;
     _sourceLevel = sourceLevel;
     _traceEventType = traceEventType;
 }
Esempio n. 5
0
		internal TraceSourceInfo (string name, SourceLevels levels, TraceImplSettings settings)
		{
			this.name = name;
			this.levels = levels;
			this.listeners = new TraceListenerCollection ();
			this.listeners.Add (new DefaultTraceListener() { IndentSize = settings.IndentSize });
		}
		private AssertNoBindingErrorsTraceListener(SourceLevels level)
		{

			WindowsRegistryAssert.HasDword(@"Software\Microsoft\Tracing\WPF", "ManagedTracing",1,"You need to add this key to your registry for Wpf report Binding Errors. \n" + RegEditText);
			PresentationTraceSources.DataBindingSource.Listeners.Add(this);
			PresentationTraceSources.DataBindingSource.Switch.Level = level;
		}
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogSource"/> class with a name, a collection of <see cref="TraceListener"/>s, a level and the auto flush.
 /// </summary>
 /// <param name="name">The name for the instance.</param>
 /// <param name="traceListeners">The collection of <see cref="TraceListener"/>s.</param>
 /// <param name="level">The <see cref="SourceLevels"/> value.</param>
 /// <param name="autoFlush">If Flush should be called on the Listeners after every write.</param>
 public LogSource(string name, IEnumerable<TraceListener> traceListeners, SourceLevels level, bool autoFlush)
 {
     this.name = name;
     this.traceListeners = new List<TraceListener>(traceListeners);
     this.level = level;
     this.autoFlush = autoFlush;
 }
		internal TraceSourceInfo (string name, SourceLevels levels, TraceImplSettings settings)
		{
			this.name = name;
			this.levels = levels;
			this.listeners = new TraceListenerCollection (false);
			this.listeners.Add (new DefaultTraceListener(), settings);
		}
Esempio n. 9
0
 LogLevel(string name, int index, SourceLevels sourceLevel, TraceEventType traceEventType)
 {
     Name = name;
     _index = index;
     SourceLevel = sourceLevel;
     TraceEventType = traceEventType;
 }
Esempio n. 10
0
		/// <summary>
		/// Initializes a new instance of the <see cref="LogSource"/> class with a name, a collection of <see cref="TraceListener"/>s and a level.
		/// </summary>
		/// <param name="name">The name for the instance.</param>
		/// <param name="traceListeners">The collection of <see cref="TraceListener"/>s.</param>
		/// <param name="level">The <see cref="SourceLevels"/> value.</param>
		public LogSource(string name, List<TraceListener> traceListeners, SourceLevels level)
		{
			this.name = name;
			this.traceListeners = traceListeners;
			this.level = level;
			this.instrumentationProvider = new LoggingInstrumentationProvider();
		}
Esempio n. 11
0
 /// <summary>
 /// Initializes the traceHandlerStreamWriter object
 /// </summary>
 /// <param name="traceSource">Trace source that holds a set of handlers</param>
 /// <param name="filterLevels">The level of trace message filtered by trace listener</param>
 /// <param name="traceOptions">Trace data options that has to be written in the trace output</param>
 /// <param name="traceFileFormat">File format component for the handler</param>
 /// <param name="fileExtension">Extension of trace file name for each handler</param>
 public Writer(TraceSource traceSource, SourceLevels filterLevels, TraceOptions traceOptions, ITraceFileFormat traceFileFormat, string fileExtension = "txt")
 {
     this.traceSource = traceSource;
     this.filterLevels = filterLevels;
     this.traceOptions = traceOptions;
     this.traceFileFormat = traceFileFormat;
     this.fileExtension = fileExtension;
 }
Esempio n. 12
0
        /// <summary>
        /// Initializes the configured switches for <see cref="LogManager"/>.
        /// </summary>
        /// <param name="diagnosticsSection">The system.diagnostics configuration section.</param>
        internal LogManager(ConfigurationSection diagnosticsSection)
        {
            SourceSwitch defaultSwitch;

            configuredSources = GetConfiguredSources(diagnosticsSection);
            configuredSwitches = GetConfiguredSwitches(diagnosticsSection);
            defaultLevel = configuredSwitches.TryGetValue("default", out defaultSwitch) ? defaultSwitch.Level : SourceLevels.Warning;
        }
        internal PiiTraceSource(string name, string eventSourceName, SourceLevels levels)
            : base(name, levels)
        {
#pragma warning disable 618
            Fx.Assert(!String.IsNullOrEmpty(eventSourceName), "Event log source name must be valid");
#pragma warning restore 618
            this.eventSourceName = eventSourceName;
        }
        private EntLib.TraceSourceData GetAllEventsSource(SourceLevels level)
        {
            var source = new EntLib.TraceSourceData();
            source.DefaultLevel = level;
            this.AddEventLogTraceListenerReference(source);

            return source;
        }
 public CouchbaseTraceListener(SourceLevels logLevel)
 {
     Level = logLevel;
     Name = "Couchbase";
     TraceOutputOptions = Level.HasFlag(SourceLevels.All)
         ? TraceOptions.ThreadId | TraceOptions.DateTime /*| TraceOptions.Timestamp*/
         :  TraceOptions.None;
 }
 public void WriteLine(SourceLevels level, string message, string category)
 {
     Console.Out.Write(String.Format("{0} {1}", LevelToString(level), category));
     Console.Out.Write(": ");
     Console.Out.Write(message);
     Console.Out.Write(Environment.NewLine);
     Console.Out.Flush();
 }
Esempio n. 17
0
 public static void SetTraceLevel(LogCategory category, SourceLevels sourceLevel)
 {
     var sourceSwitch = new SourceSwitch(string.Format(CultureInfo.InvariantCulture, "MigSharp.{0}.Switch", category))
     {
         Level = sourceLevel
     };
     Sources[category].Switch = sourceSwitch;
 }
Esempio n. 18
0
        static GitHubController()
        {
            var tracingLevel = ConfigurationManager.AppSettings["TracingLevel"];
            SourceLevels sourceLevel = SourceLevels.Information;
            Enum.TryParse<SourceLevels>(tracingLevel, out sourceLevel);

            traceLevel = sourceLevel;
        }
        public CustomTextTraceSource(string targetClassAndMethodName, string sourceName, SourceLevels defaultLevel) :
            base(sourceName, defaultLevel)
        {
            _targetClassAndMethodName = targetClassAndMethodName;

            TraceDateTime();
            TraceClassAndMethod();
        }
Esempio n. 20
0
		public BREFactoryConsole(SourceLevels engineTraceLevel, SourceLevels ruleBaseTraceLevel) {
			Logger.FlowEngineSource.Switch.Level = engineTraceLevel;
			Logger.FlowEngineRuleBaseSource.Switch.Level = ruleBaseTraceLevel;
			Logger.RefreshBooleanSwitches();
			
			ConsoleTraceListener ctl = new ConsoleTraceListener();
			Logger.FlowEngineSource.Listeners.Add(ctl);
			Logger.FlowEngineRuleBaseSource.Listeners.Add(ctl);
		}
Esempio n. 21
0
 public LogImplementation(SourceLevels level)
 {
     var factory = new LoggingConfigurationSourceFactory();
     var configurationSource = factory.Create(level);
     this.entLibSettings =
         configurationSource.GetSection(EntLib.LoggingSettings.SectionName)
         as EntLib.LoggingSettings;
     this.logWriter = new LogWriterFactory(configurationSource).Create();
     this.loggingEnabled = true;
 }
Esempio n. 22
0
		public ThreadSafeTracer(string name, SourceLevels tracingLevel)
		{
			this.tracer = new TraceSource(name)
			{
				Switch = new SourceSwitch("Main switch")
				{
					Level = tracingLevel
				}
			};
		}
        private EntLib.LoggingSettings CreateLoggingSettings(SourceLevels level)
        {
            var entLibSettings = new EntLib.LoggingSettings();

            this.AddFormatters(entLibSettings);
            this.AddEventLogTraceListener(entLibSettings);
            this.AddApplicationCategorySource(entLibSettings);
            this.AddSpecialSources(level, entLibSettings);

            return entLibSettings;
        }
        public static void SetTrace(SourceLevels level, TraceOptions options)
        {
            if (_listener == null)
              {
            _listener = new BindingErrorTraceListener();
            PresentationTraceSources.DataBindingSource.Listeners.Add(_listener);
              }

              _listener.TraceOutputOptions = options;
              PresentationTraceSources.DataBindingSource.Switch.Level = level;
        }
        public IConfigurationSource Create(SourceLevels level)
        {
            var loggingConfigSource = new DictionaryConfigurationSource();
            var entLibSettings = this.CreateLoggingSettings(level);
            if (entLibSettings != null)
            {
                loggingConfigSource.Add(EntLib.LoggingSettings.SectionName, entLibSettings);
            }

            return loggingConfigSource;
        }
 private static void UpdateLevel()
 {
     level = DiagnosticTrace.Level;
     tracingEnabled = DiagnosticTrace.TracingEnabled;
     shouldTraceCritical = DiagnosticTrace.ShouldTrace(TraceEventType.Critical);
     shouldTraceError = DiagnosticTrace.ShouldTrace(TraceEventType.Error);
     shouldTraceInformation = DiagnosticTrace.ShouldTrace(TraceEventType.Information);
     shouldTraceWarning = DiagnosticTrace.ShouldTrace(TraceEventType.Warning);
     shouldTraceVerbose = DiagnosticTrace.ShouldTrace(TraceEventType.Verbose);
     shouldUseActivity = DiagnosticTrace.ShouldUseActivity;
 }
Esempio n. 27
0
        /// <summary>
        /// Prevents a default instance of the <see cref="Logger"/> class from being created.
        /// </summary>
        private Logger()
        {
            this.traceSources.Add(new TraceSource(WorkflowActivityLibraryLogSourceName));
            this.traceSources.Add(new TraceSource(ResourceManagementLogSourceName));
            this.traceSources.Add(new TraceSource(EventTracingForWindowsResourceManagementLogSourceName));

            this.currentSourceLevel = SourceLevels.Off;
            foreach (TraceSource ts in this.traceSources.Where(ts => this.currentSourceLevel < ts.Switch.Level))
            {
                this.currentSourceLevel = ts.Switch.Level;
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Gets the closest "parent" TraceRoute that has listeners, or null otherwise
        /// </summary>
        /// <param name="name"></param>
        /// <param name="sourceLevels"></param>
        /// <returns></returns>
        private static TraceSource GetTraceSourceWithListenersSyncLock(string name, SourceLevels sourceLevels)
        {
            string[] splitters = name.Split(new char[] { '.' }, StringSplitOptions.None);
            List<string> nameSplitList = new List<string>();
            StringBuilder builder = new StringBuilder();

            foreach (string split in splitters)
            {
                if (builder.Length > 0)
                {
                    builder.Append(".");
                }

                builder.Append(split);

                string partialName = builder.ToString();
                nameSplitList.Add(partialName);
            }

            nameSplitList.Reverse();

            foreach (string nameSplit in nameSplitList)
            {
                TraceSource sourceTrace = null;
                sourceTrace = new TraceSource(nameSplit, sourceLevels);

                if (sourceTrace.Listeners == null || sourceTrace.Listeners.Count == 0)
                {
                    sourceTrace.Close();
                    continue;
                }

                if (sourceTrace.Listeners.Count > 1)
                {
                    return sourceTrace;
                }
                TraceListener listenerTrace = sourceTrace.Listeners[0];

                if (!(listenerTrace is DefaultTraceListener))
                {
                    return sourceTrace;
                }
                
                if (!string.Equals(listenerTrace.Name, "Default", StringComparison.Ordinal))
                {
                    return sourceTrace;
                }
                sourceTrace.Close();
            }

            return null;
        }
 protected override void OnSetLevel(SourceLevels level)
 {
     if (this.TraceSource != null)
     {
         if (this.TraceSource.Switch.Level != SourceLevels.Off &&
             level == SourceLevels.Off)
         {
             TraceSource temp = this.TraceSource;
             this.CreateTraceSource();
             temp.Close();
         }
         this.shouldUseActivity = (level & SourceLevels.ActivityTracing) != 0;
     }
 }
		/// <summary>Set/Update the trave level</summary>
		/// <param name="level"></param>
		public static void SetLevel(SourceLevels level)
		{
			lock (s_lock)
			{
				if (s_initialized) Close();
				s_enabled = false;
				if (level != SourceLevels.Off)
				{
					s_traceSource = new TraceSource("FoundationDB.Client", level);
					s_enabled = true;
				}
				s_initialized = true;
			}
		}
 // Constructors
 public EventTypeFilter(SourceLevels level)
 {
 }
            public ILoggingConfigurationSendToFlatFileTraceListener Filter(SourceLevels sourceLevel)
            {
                flatFileTracelistenerData.Filter = sourceLevel;

                return(this);
            }
 public void WriteLine(SourceLevels level, string message, string category)
 {
     Level = level;
     WriteLine(message, category);
 }
Esempio n. 34
0
        public void TraceLevelIsEqualToPassedTraceLevel([Values] SourceLevels traceLevel)
        {
            var builder = IsDayOffSettings.Build.UseLogging(traceLevel).Create();

            Assert.That(builder.TraceLevel, Is.EqualTo(traceLevel));
        }
Esempio n. 35
0
        /// <summary>
        ///     Warning: this is not tread-safe, so only call this at startup or at a time that you are sure your
        ///     process is not performing any logging!
        /// </summary>
        /// <param name="filePath">The path to the log file.</param>
        /// <param name="sourceLevels">The lowest log level to log.</param>
        public static void SetLogFilePath(string filePath, SourceLevels sourceLevels)
        {
            if (!System.IO.Path.IsPathRooted(filePath))
            {
                filePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
                                                  System.IO.Path.Combine(@"SatIp RtspSample\Logs", filePath));
            }

            Level level = Level.Debug;

            if (_sourceLevels == SourceLevels.Information)
            {
                level = Level.Info;
            }
            else if (_sourceLevels == SourceLevels.Warning)
            {
                level = Level.Warn;
            }
            else if (_sourceLevels == SourceLevels.Error)
            {
                level = Level.Error;
            }
            else if (_sourceLevels == SourceLevels.Critical)
            {
                level = Level.Fatal;
            }
            _sourceLevels = sourceLevels;

            var hierarchy =
                (log4Hierarchy.Hierarchy)LogManager.GetAllRepositories().FirstOrDefault(r => r.Name == Path) ??
                (log4Hierarchy.Hierarchy)LogManager.CreateRepository(Path);

            hierarchy.Root.RemoveAllAppenders();

            var roller        = new RollingFileAppender();
            var patternLayout = new PatternLayout {
                ConversionPattern = "%date [%-5level][%thread]: %message%newline"
            };

            patternLayout.ActivateOptions();
            roller.Layout             = patternLayout;
            roller.AppendToFile       = true;
            roller.RollingStyle       = RollingFileAppender.RollingMode.Size;
            roller.MaxSizeRollBackups = 4;
            roller.MaximumFileSize    = "1000KB";
            roller.StaticLogFileName  = true;
            roller.File = filePath;
            roller.ActivateOptions();
            roller.AddFilter(new LevelRangeFilter
            {
                LevelMin = level,
                LevelMax = Level.Fatal
            });
            BasicConfigurator.Configure(hierarchy, roller);

            var coreLogger = hierarchy.GetLogger(Path) as log4Hierarchy.Logger;

            if (coreLogger != null)
            {
                coreLogger.Level = level;
            }

            _log = LogManager.GetLogger(hierarchy.Name, Path);
        }
Esempio n. 36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="System.Diagnostics.TraceSource"/> class.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="level">Level.</param>
 public TraceSource(string name, SourceLevels level)
 {
     //_tag = name;
     this.Listeners = new List <TraceListener>();
 }
        public static IDisposable Start(SourceLevels level = SourceLevels.Warning)
        {
            var listener = new AssertNoBindingErrorsTraceListener(level);

            return(new DisposableToken(listener));
        }
Esempio n. 38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MsmqTraceListenerData"/> class.
 /// </summary>
 /// <param name="name">The name for the represented trace listener.</param>
 /// <param name="queuePath">The path name for the represented trace listener.</param>
 /// <param name="formatterName">The formatter name for the represented trace listener.</param>
 /// <param name="messagePriority">The priority for the represented trace listener.</param>
 /// <param name="recoverable">The recoverable flag for the represented trace listener.</param>
 /// <param name="timeToReachQueue">The timeToReachQueue for the represented trace listener.</param>
 /// <param name="timeToBeReceived">The timeToReachQueue for the represented trace listener.</param>
 /// <param name="useAuthentication">The use authentication flag for the represented trace listener.</param>
 /// <param name="useDeadLetterQueue">The use dead letter flag for the represented trace listener.</param>
 /// <param name="useEncryption">The use encryption flag for the represented trace listener.</param>
 /// <param name="transactionType">The transaction type for the represented trace listener.</param>
 /// <param name="traceOutputOptions">The trace output options for the represented trace listener.</param>
 /// <param name="filter">The filter for the represented trace listener.</param>
 public MsmqTraceListenerData(string name, string queuePath, string formatterName,
                              MessagePriority messagePriority, bool recoverable,
                              TimeSpan timeToReachQueue, TimeSpan timeToBeReceived,
                              bool useAuthentication, bool useDeadLetterQueue, bool useEncryption,
                              MessageQueueTransactionType transactionType, TraceOptions traceOutputOptions, SourceLevels filter)
     : base(name, typeof(MsmqTraceListener), traceOutputOptions, filter)
 {
     this.QueuePath          = queuePath;
     this.Formatter          = formatterName;
     this.MessagePriority    = messagePriority;
     this.Recoverable        = recoverable;
     this.TimeToReachQueue   = timeToReachQueue;
     this.TimeToBeReceived   = timeToBeReceived;
     this.UseAuthentication  = useAuthentication;
     this.UseDeadLetterQueue = useDeadLetterQueue;
     this.UseEncryption      = useEncryption;
     this.TransactionType    = transactionType;
 }
Esempio n. 39
0
        /// <summary>
        /// Configures the specified trace source to write to a file.
        /// </summary>
        /// <param name="source">The trace source.</param>
        /// <param name="filePath">The file path.</param>
        /// <param name="levels">The trace levels.</param>
        public static void Configure(string source, string filePath, SourceLevels levels)
        {
            StreamWriter textWriter = new StreamWriter(filePath, true);

            Configure(source, textWriter, levels);
        }
 /// <summary>
 /// Initializes a <see cref="EmailTraceListenerData"/> with a toaddress,
 /// fromaddress, subjectLineStarter, subjectLineEnder, smtpServer, a formatter name, trace options
 /// and authentication information.
 /// </summary>
 /// <param name="name">The name of this listener</param>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="formatterName">The name of the Formatter <see cref="ILogFormatter"/> which determines how the
 ///email message should be formatted</param>
 /// <param name="traceOutputOptions">The trace options.</param>
 /// <param name="filter">The filter to apply.</param>
 /// <param name="authenticationMode">Authenticate mode to use.</param>
 /// <param name="userName">User name to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="password">Password to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="useSSL">Connect to the server using SSL?</param>
 public EmailTraceListenerData(string name,
                               string toAddress, string fromAddress,
                               string subjectLineStarter, string subjectLineEnder,
                               string smtpServer, int smtpPort,
                               string formatterName, TraceOptions traceOutputOptions, SourceLevels filter,
                               EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
     : base(name, typeof(EmailTraceListener), traceOutputOptions, filter)
 {
     this.ToAddress          = toAddress;
     this.FromAddress        = fromAddress;
     this.SubjectLineStarter = subjectLineStarter;
     this.SubjectLineEnder   = subjectLineEnder;
     this.SmtpServer         = smtpServer;
     this.SmtpPort           = smtpPort;
     this.Formatter          = formatterName;
     this.AuthenticationMode = authenticationMode;
     this.UserName           = userName;
     this.Password           = password;
     this.UseSSL             = useSSL;
 }
 /// <summary>
 /// Initializes a <see cref="EmailTraceListenerData"/> with a toaddress,
 /// fromaddress, subjectLineStarter, subjectLineEnder, smtpServer, a formatter name and trace options.
 /// </summary>
 /// <param name="name">The name of this listener</param>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="formatterName">The name of the Formatter <see cref="ILogFormatter"/> which determines how the
 ///email message should be formatted</param>
 /// <param name="traceOutputOptions">The trace options.</param>
 /// <param name="filter">The filter to apply.</param>
 public EmailTraceListenerData(string name, string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, string formatterName, TraceOptions traceOutputOptions, SourceLevels filter)
     : base(name, typeof(EmailTraceListener), traceOutputOptions, filter)
 {
     this.ToAddress          = toAddress;
     this.FromAddress        = fromAddress;
     this.SubjectLineStarter = subjectLineStarter;
     this.SubjectLineEnder   = subjectLineEnder;
     this.SmtpServer         = smtpServer;
     this.SmtpPort           = smtpPort;
     this.Formatter          = formatterName;
 }
Esempio n. 42
0
            public ILoggingConfigurationSendToSystemDiagnosticsTraceListener Filter(SourceLevels sourceLevel)
            {
                systemDiagnosticsData.Filter = sourceLevel;

                return(this);
            }
Esempio n. 43
0
 public MonoDevelopTracer(string name, SourceLevels level = SourceLevels.Warning)
 {
     Source = new TraceSource(name);
     Level  = level;
 }
 public void SetTracingLevel(string sourceName, SourceLevels level)
 {
     GetOrAdd(sourceName).Switch.Level = level;
 }
 private AssertNoBindingErrorsTraceListener(SourceLevels level)
 {
     WindowsRegistryAssert.HasDword(@"Software\Microsoft\Tracing\WPF", "ManagedTracing", 1, "You need to add this key to your registry for Wpf report Binding Errors. \n" + RegEditText);
     PresentationTraceSources.DataBindingSource.Listeners.Add(this);
     PresentationTraceSources.DataBindingSource.Switch.Level = level;
 }
Esempio n. 46
0
 public static void SetDebugLevel(SourceLevels swlvl = SourceLevels.Information)
 {
     _trace.Switch.Level = swlvl;
     _trace.TraceEvent(TraceEventType.Verbose, 0, "Created Merger");
 }
Esempio n. 47
0
 public TraceSourceInfo(string name, SourceLevels levels)
 {
     this.name      = name;
     this.levels    = levels;
     this.listeners = new TraceListenerCollection();
 }
        private void AddTraceSource(IDictionary d, Hashtable sources, XmlNode node)
        {
            string           name   = null;
            SourceLevels     levels = SourceLevels.Error;
            StringDictionary atts   = new StringDictionary();

            foreach (XmlAttribute a in node.Attributes)
            {
                switch (a.Name)
                {
                case "name":
                    name = a.Value;
                    break;

                case "switchValue":
                    levels = (SourceLevels)Enum.Parse(typeof(SourceLevels), a.Value);
                    break;

                default:
                    atts [a.Name] = a.Value;
                    break;
                }
            }
            if (name == null)
            {
                throw new ConfigurationException("Mandatory attribute 'name' is missing in 'source' element.");
            }

            // ignore duplicate ones (no error occurs)
            if (sources.ContainsKey(name))
            {
                return;
            }

            TraceSourceInfo sinfo = new TraceSourceInfo(name, levels, configValues);

            sources.Add(sinfo.Name, sinfo);

            foreach (XmlNode child in node.ChildNodes)
            {
                XmlNodeType t = child.NodeType;
                if (t == XmlNodeType.Whitespace || t == XmlNodeType.Comment)
                {
                    continue;
                }
                if (t == XmlNodeType.Element)
                {
                    if (child.Name == "listeners")
                    {
                        AddTraceListeners(d, child, sinfo.Listeners);
                    }
                    else
                    {
                        ThrowUnrecognizedElement(child);
                    }
                    ValidateInvalidAttributes(child.Attributes, child);
                }
                else
                {
                    ThrowUnrecognizedNode(child);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TraceSourceForEventSource" /> class.
 /// </summary>
 public TraceSourceForEventSource(SourceLevels defaultLevel)
     : base(TraceSourceName, defaultLevel)
 {
     this.listener = new DiagnosticsEventListener(GetEventLevelFromSourceLevels(defaultLevel), (EventKeywords)AllKeyword, this);
 }
 public TraceSource(string name, SourceLevels defaultLevel)
 {
 }
Esempio n. 51
0
 public TraceSource(string name, SourceLevels level)
 {
 }
Esempio n. 52
0
 public BilgeConditionalRoutedBase(BilgeRouter rt, ConfigSettings cs, SourceLevels yourTraceLevel) : base(rt, cs)
 {
     activeTraceLevel = yourTraceLevel;
 }
Esempio n. 53
0
 public static Tracer GetTracer(Type type, SourceLevels defaultLevel)
 {
     return(Tracer.GetTracer(type.FullName, defaultLevel));
 }
Esempio n. 54
0
        /// <summary>
        /// Bilge provides developer level trace to provide runtime diagnostics to developers.
        /// </summary>
        /// <param name="selectedInstanceContext">The context for this particular instance of bilge, usually used to identify a subsystem</param>
        /// <param name="sessionContext">The context for a session, usually used to identify the user request</param>
        /// <param name="tl">The trace level to set this instance of bilge to</param>
        /// <param name="resetDefaults">Reset all pf the internal context of Bilge</param>
        public Bilge(string selectedInstanceContext = "-", string sessionContext = "-", SourceLevels tl = SourceLevels.Off, bool resetDefaults = false)
        {
            activeConfig = new ConfigSettings();
            activeConfig.InstanceContext = selectedInstanceContext;
            activeConfig.SessionContext  = sessionContext;
            string procId = Process.GetCurrentProcess().Id.ToString();

            if (resetDefaults)
            {
                BilgeRouter.Router.ClearEverything();
            }

            Assert   = new BilgeAssert(BilgeRouter.Router, activeConfig);
            Info     = new InfoWriter(BilgeRouter.Router, activeConfig, SourceLevels.Information | SourceLevels.Error | SourceLevels.Critical);
            Verbose  = new VerboseWriter(BilgeRouter.Router, activeConfig, SourceLevels.All);
            Warning  = new WarningWriter(BilgeRouter.Router, activeConfig, SourceLevels.Warning | SourceLevels.Error | SourceLevels.Critical);
            Error    = new ErrorWriter(BilgeRouter.Router, activeConfig, SourceLevels.Error | SourceLevels.Critical);
            Critical = new ErrorWriter(BilgeRouter.Router, activeConfig, SourceLevels.Critical);
            Direct   = new BilgeDirect(BilgeRouter.Router, activeConfig);
            Util     = new BilgeUtil(BilgeRouter.Router, activeConfig);

            var level = levelResolver(selectedInstanceContext, tl);

            SetTraceLevel(level);
        }
 protected TraceListenerNode(TraceOptions traceOptions, SourceLevels filter)
 {
     this.filter       = filter;
     this.traceOptions = traceOptions;
 }
Esempio n. 56
0
 public Log4netTraceFilter(SourceLevels level)
 {
     _traceLevel = level;
 }
Esempio n. 57
0
 protected virtual void OnSetLevel(SourceLevels level)
 {
 }
Esempio n. 58
0
 public CustomLogger(SourceLevels logLevel)
 {
     level = logLevel;
     ts    = new CouchbaseTraceListener(logLevel);
 }
 public EventTypeFilter(SourceLevels eventType)
 {
     event_type = eventType;
 }
Esempio n. 60
0
 public LogTraceSource(string name, SourceLevels level)
     : base(name, level)
 {
 }