public void SetIfNone(TraceLevel level)
 {
     if (!_traceLevel.HasValue)
     {
         _traceLevel = level;
     }
 }
 public void SetIfNone(TraceLevel level)
 {
     if (!_traceLevel.HasValue)
     {
         _traceLevel = level;
     }
 }
        public DiagnosticsSettings()
        {
            MaxRequests = 200;

            if (FubuMode.InDevelopment())
            {
                _traceLevel = TraceLevel.Verbose;
            }
        }
Exemple #4
0
        public DiagnosticsSettings()
        {
            MaxRequests = 200;

            if (FubuMode.InDevelopment())
            {
                _traceLevel = TraceLevel.Verbose;
            }
        }
Exemple #5
0
 public void GetMappedTraceLevel_ReturnsExpectedTraceLevel(
     Exception exception,
     TraceLevel?expectedTraceLevel
     )
 {
     Assert.Equal(
         expectedTraceLevel,
         TraceWriterExceptionMapper.GetMappedTraceLevel(exception)
         );
 }
Exemple #6
0
        /// <summary>
        /// Creates the lsp server process object
        /// </summary>
        /// <returns></returns>
        public System.Diagnostics.Process Create(TraceLevel?traceLevel = TraceLevel.Info)
        {
            var    assembly  = Assembly.GetAssembly(typeof(LanguageServerClientProcess));
            string arguments = null;
            var    exe       = @"node.exe";
            var    logPath   = $"{Application.LogPath}{Application.LogNameAgent}";

#if DEBUG
            var path = Path.GetDirectoryName(assembly.Location) + @"\dist\agent.js";
            arguments = $@"--nolazy --inspect=6010 ""{path}"" --stdio --log={logPath}";
            Node.EnsureVersion(exe);
#else
            exe       = Path.GetDirectoryName(assembly.Location) + @"\dist\agent.exe";
            arguments = $@"--stdio --nolazy --log={logPath}";
#endif
            return(ProcessFactory.Create(exe, arguments, false));
        }
Exemple #7
0
        public static string GetSubjectPrefix(Exception ex = null, TraceLevel?type = null)
        {
            var    asm = Assembly.GetEntryAssembly();
            string s   = "Unknown Entry Assembly";

            if (asm == null && ex != null)
            {
                var frames = new StackTrace(ex).GetFrames();
                if (frames != null)
                {
                    for (int i = 0; i < frames.Length; i++)
                    {
                        var method = frames[i].GetMethod();
                        if (method != null)
                        {
                            asm = method.DeclaringType.Assembly;
                            break;
                        }
                    }
                }
            }
            if (asm == null)
            {
                asm = Assembly.GetCallingAssembly();
            }
            if (asm != null)
            {
                var last2Nodes = asm.GetName().Name.Split('.').Reverse().Take(2).Reverse();
                s = string.Join(".", last2Nodes);
            }
            if (type.HasValue)
            {
                s += string.Format(" {0}", type);
            }
            ApplyRunModeSuffix(ref s);
            s += ": ";
            return(s);
        }
Exemple #8
0
        /// <summary>
        /// Gets the <see cref="TraceLevel"/> per the <see cref="HttpStatusCode"/>.
        /// </summary>
        /// <param name="httpResponseException">The exception for which the trace level has to be found.</param>
        /// <returns>The mapped trace level.</returns>
        public static TraceLevel?GetMappedTraceLevel(HttpResponseException httpResponseException)
        {
            Contract.Assert(httpResponseException != null);

            HttpResponseMessage response = httpResponseException.Response;

            Contract.Assert(response != null);

            TraceLevel?level = null;

            // Client level errors are downgraded to TraceLevel.Warn
            if ((int)response.StatusCode < (int)HttpStatusCode.InternalServerError)
            {
                level = TraceLevel.Warn;
            }

            // Non errors are downgraded to TraceLevel.Info
            if ((int)response.StatusCode < (int)HttpStatusCode.BadRequest)
            {
                level = TraceLevel.Info;
            }

            return(level);
        }
 public string GetWithNullableEnumParameter(TraceLevel?level)
 {
     return(level.ToString());
 }