Logger

public static class Logger
General utility class for various runtime diagnostics.

Fields

HideSensitiveInformationFromLog

#
Gets or sets whether personal information (such as UserName or MachineName ought to be included in the log. This flag must be set SUUUPER early on because the first thing the Logger does it dump a bunch of system info into the current log stream. At present, this value is not assigned at all, given that https://www.mcneel.com/privacy allows us to write all this data. The problem arises only when the user decides to share the log files, at which point it will be much harder to remove any specific entry.
[EditorBrowsable(EditorBrowsableState.Never)] public static bool HideSensitiveInformationFromLog

Properties

Count

#
Gets the number of recorded messages in the current log.
public static int Count { get; }

Density

#
Gets or sets the logging density.
public static Density Density { get; set; }

Methods

Add

#
Log an exception message.
public static void Add(
exception,
Exception to log.
context
Exception context description.
)

Add

#
Log an exception message.
public static void Add(
exception
Exception to log.
)

Add

#
Log a message. This method is threadsafe.
public static void Add(
level,
Message type.
message
Message to log.
)

Clear

#
Attempt to clear the current log file.
public static void Clear()

DeleteOldLogFiles

#
Delete all log files older than one day.
public static int DeleteOldLogFiles()
Number of log files deleted.

DeleteOldLogFiles

#
Delete all log files older than the retirement age.
public static int DeleteOldLogFiles(
retirementAge
Age at which a log file is considered ripe for deletion.
)
Number of log files deleted.

Diagnostics

#
Read all entries from the current log file.
public static Entry[] Diagnostics()
Array of entries.

Diagnostics

#
Read all parseable entries from an existing log file.
public static Entry[] Diagnostics(
byte[]
bytes
Log byte array.
)
Array of entries.

Diagnostics

#
Read all parseable entries from an existing log file.
public static Entry[] Diagnostics(
logFile
Log file.
)
Array of entries.

DumpDiagnosticsToFile

#
Write a set of diagnostic messages to an HTML file. This method will not throw.
public static bool DumpDiagnosticsToFile(
file,
File path.
entries
Entries to include.
)
True if file was written or updated, false if otherwise.

LogCurrentState

#
Write a bunch of information to the log describing the current state of the computer.
public static void LogCurrentState()

MeasureSpan

#
Begin a new timespan measure. You *must* dispose this metric in order to include the measures interval in the log.
public static TimeSpanMetric MeasureSpan(
name
Name of metric.
)
Dispoable object for timespan measurement.

MeasureSpan

#
Begin a new timespan measure. You *must* dispose this metric in order to include the measures interval in the log.
public static TimeSpanMetric MeasureSpan(
threshold,
Reporting threshold.
name
Name of metric.
)
Dispoable object for timespan measurement.

ShowDiagnosticsInBrowser

#
Show the provided logged entries in a window, and save them as an HTML file on the desktop, or in the temp folder if the desktop cannot be written to.
public static string ShowDiagnosticsInBrowser(
entries
Entries to include.
)
The path to the html file if it could be saved, otherwise null. The window is shown regardless.