Endjin.Assembly.ChangeDetection.Infrastructure.Tracer.Error C# (CSharp) Method

Error() public static method

Write an exception to the configured output device.
public static Error ( Level level, TypeHashes type, string method, Exception ex, string fmt ) : void
level Level Trace Level. 1 is the high level overview, 5 is for high volume detailed traces.
type TypeHashes /// TypeHandle instance which identifies your class type. This instance should be a static instance of /// your type. ///
method string The method name of your current method.
ex System.Exception The exception to trace.
fmt string Message describing what the exception is about.
return void
        public static void Error(Level level, TypeHashes type, string method, Exception ex, string fmt, params object[] args)
        {
            if (ex == null)
            {
                throw new ArgumentNullException("ex");
            }
            if (fmt == null)
            {
                throw new ArgumentNullException("fmt");
            }
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (TracerConfig.Instance.IsEnabled(type, MessageTypes.Error, level))
            {
                var traceMsg = FormatStringSafe(fmt, args);
                TraceMsg(MsgTypeError, GenerateTypeMethodName(type, method), DateTime.Now, "{0}{1}{2}", traceMsg, Environment.NewLine, ex);
            }
        }

Same methods

Tracer::Error ( Exception ex ) : void
Tracer::Error ( Exception ex, string fmt ) : void
Tracer::Error ( Level level, Exception ex ) : void
Tracer::Error ( Level level, Exception ex, string fmt ) : void
Tracer::Error ( Level level, TypeHashes type, string method, Exception ex ) : void
Tracer::Error ( Level level, TypeHashes type, string method, string fmt ) : void
Tracer::Error ( Level level, string fmt ) : void
Tracer::Error ( string fmt ) : void

Usage Example

        public ISymbolReader LoadPdbForModule(ModuleDefinition module)
        {
            using (Tracer t = new Tracer(myType, "LoadPdbForModule"))
            {
                string fileName = module.Assembly.MainModule.FullyQualifiedName;
                t.Info("Module file name: {0}", fileName);
                ISymbolReader reader = null;

                if (!this.myFile2PdbMap.TryGetValue(fileName, out reader))
                {
                    if (this.myFailedPdbs.Contains(fileName))
                    {
                        t.Warning("This pdb could not be successfully downloaded");
                        return reader;
                    }

                    for (int i = 0; i < 2; i++)
                    {
                        try
                        {
                            reader = this.myPdbFactory.GetSymbolReader(module, fileName);
                            this.myFile2PdbMap[fileName] = reader;
                            break;
                        }
                        catch (Exception ex)
                        {
                            t.Error(Level.L3, ex, "Pdb did not match or it is not present");

                            string pdbFileName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".pdb");
                            try
                            {
                                File.Delete(pdbFileName);
                            }
                            catch (Exception delex)
                            {
                                t.Error(Level.L2, delex, "Could not delete pdb {0}", pdbFileName);
                            }

                            // When we have symbol server we try to make us of it for matches.
                            if (String.IsNullOrEmpty(this.mySymbolServer))
                            {
                                break;
                            }

                            t.Info("Try to download pdb from symbol server {0}", this.mySymbolServer);
                            bool bDownloaded = this.myDownLoader.DownloadPdbs(new FileQuery(fileName), this.mySymbolServer);
                            t.Info("Did download pdb {0} from symbol server with return code: {1}", fileName, bDownloaded);

                            if (bDownloaded == false || i == 1) // second try did not work out as well
                            {
                                this.myFailedPdbs.Add(fileName);
                                break;
                            }
                        }
                    }
                }

                return reader;
            }
        }
All Usage Examples Of Endjin.Assembly.ChangeDetection.Infrastructure.Tracer::Error