private static void LogEntryPath(ActivityLogEntryType type, string source, string message, string path) { IVsActivityLog log = Log; if (log != null) { log.LogEntryPath(VsxConverter.MapLogTypeToAle(type), source, message, path); } }
private static void LoadOneProvider( string codebase, HashSet <string> seen, List <ComposablePartCatalog> catalog, IVsActivityLog log ) { if (string.IsNullOrEmpty(codebase)) { return; } if (!seen.Add(codebase)) { return; } if (log != null) { log.LogEntryPath( (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION, "Python Tools", "Loading interpreter provider assembly", codebase ); } AssemblyCatalog assemblyCatalog = null; const string FailedToLoadAssemblyMessage = "Failed to load interpreter provider assembly"; try { assemblyCatalog = new AssemblyCatalog(codebase); } catch (Exception ex) { LogException(log, FailedToLoadAssemblyMessage, codebase, ex); } if (assemblyCatalog == null) { return; } const string FailedToLoadMessage = "Failed to load interpreter provider"; try { catalog.Add(assemblyCatalog); } catch (Exception ex) { LogException(log, FailedToLoadMessage, codebase, ex); } }
/// <summary> /// Creates a new log entry /// </summary> /// <param name="type">Category of the entry</param> /// <param name="message">Message</param> /// <param name="path">File path that will be written to the log</param> public static void Log(EntryType type, string message, string path) { if (message == null) { throw new ArgumentNullException("message"); } if (path == null) { throw new ArgumentNullException("path"); } if (Source == null) { throw new InvalidOperationException("ActivityLogger is not sufficiently initialized."); } int hr = logService.LogEntryPath((uint)type, Source, message, path); Marshal.ThrowExceptionForHR(hr); }
private static void LogException( IVsActivityLog log, string message, string path, Exception ex, IEnumerable <object> data = null ) { if (log == null) { return; } var fullMessage = string.Format("{1}:{0}{2}{0}{3}", Environment.NewLine, message, ex, data == null ? string.Empty : string.Join(Environment.NewLine, data) ).Trim(); if (string.IsNullOrEmpty(path)) { log.LogEntry( (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, "Python Tools", fullMessage ); } else { log.LogEntryPath( (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, "Python Tools", fullMessage, path ); } }
private static void LoadOneProvider( string codebase, HashSet<string> seen, List<ComposablePartCatalog> catalog, IVsActivityLog log ) { if (string.IsNullOrEmpty(codebase)) { return; } if (!seen.Add(codebase)) { return; } if (log != null) { log.LogEntryPath( (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_INFORMATION, "Python Tools", "Loading interpreter provider assembly", codebase ); } AssemblyCatalog assemblyCatalog = null; const string FailedToLoadAssemblyMessage = "Failed to load interpreter provider assembly"; try { assemblyCatalog = new AssemblyCatalog(codebase); } catch (Exception ex) { LogException(log, FailedToLoadAssemblyMessage, codebase, ex); } if (assemblyCatalog == null) { return; } const string FailedToLoadMessage = "Failed to load interpreter provider"; try { catalog.Add(assemblyCatalog); } catch (Exception ex) { LogException(log, FailedToLoadMessage, codebase, ex); } }
private static void LogException( IVsActivityLog log, string message, string path, Exception ex, IEnumerable<object> data = null ) { if (log == null) { return; } var fullMessage = string.Format("{1}:{0}{2}{0}{3}", Environment.NewLine, message, ex, data == null ? string.Empty : string.Join(Environment.NewLine, data) ).Trim(); if (string.IsNullOrEmpty(path)) { log.LogEntry( (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, "Python Tools", fullMessage ); } else { log.LogEntryPath( (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, "Python Tools", fullMessage, path ); } }