Class TraceLogger
This static class exposes methods that support every conceivable combination of local and UTC time stamps for trace logging.
Inheritance
Namespace: WizardWrx.Core
Assembly: WizardWrx.Core.dll
Syntax
public static class TraceLogger : object
Remarks
The methods that record both local and UTC time capture the current UTC time, then convert it into local time. This guarantees that both times are truly equal, and that local and UTC times are unambiguous.
Methods
| Improve this Doc View SourceForceAutoFlush(StreamWriter)
Force a System.IO.StreamWriter into AutoFlush mode.
Declaration
public static bool ForceAutoFlush(StreamWriter psw)
Parameters
Type | Name | Description |
---|---|---|
StreamWriter | psw | Specify the System.IO.StreamWriter to make AutoFlush. |
Returns
Type | Description |
---|---|
System.Boolean | The return value is True when |
WriteWithBothTimesLabeledLocalFirst(String, StreamWriter)
Write a time stamped trace log message, using the local and UTC machine times as its time stamp prefix, local first, followed by UTC in parentheses.
Declaration
public static void WriteWithBothTimesLabeledLocalFirst(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithBothTimesLabeledLocalFirstWithPassThrough(String, StreamWriter)
Call WriteWithBothTimesLabeledLocalFirst to write the message either to the active Trace Listener or the alternate StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithBothTimesLabeledLocalFirstWithPassThrough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |
WriteWithBothTimesLabeledUTCFirst(String, StreamWriter)
Write a time stamped trace log message, using the local and UTC machine times as its time stamp prefix, UTC first, followed by local in parentheses.
Declaration
public static void WriteWithBothTimesLabeledUTCFirst(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithBothTimesLabeledUTCFirstWithPassTrhough(String, StreamWriter)
Call WriteWithBothTimesLabeledUTCFirst and write the message to the active Trace Listener or the supplied StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithBothTimesLabeledUTCFirstWithPassTrhough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |
WriteWithBothTimesUnlabeledLocalFirst(String, StreamWriter)
Write a time stamped trace log message, using the local and UTC machine times as its time stamp prefix, local first, followed by UTC in parentheses.
Declaration
public static void WriteWithBothTimesUnlabeledLocalFirst(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithBothTimesUnlabeledLocalFirstWithPassThrough(String, StreamWriter)
Call WriteWithBothTimesUnlabeledLocalFirst and write the message to the active Trace Listener or the supplied StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithBothTimesUnlabeledLocalFirstWithPassThrough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |
WriteWithBothTimesUnlabeledUTCFirst(String, StreamWriter)
Write a time stamped trace log message, using the local and UTC machine times as its time stamp prefix, UTC first, followed by local in parentheses.
Declaration
public static void WriteWithBothTimesUnlabeledUTCFirst(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithBothTimesUnlabeledUTCFirstWithPassThrough(String, StreamWriter)
Call WriteWithBothTimesUnlabeledUTCFirst and write the message to the active Trace Listener or the supplied StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithBothTimesUnlabeledUTCFirstWithPassThrough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |
WriteWithLabeledLocalTime(String, StreamWriter)
Write a time stamped trace log message, using the local machine time as its time stamp prefix.
Declaration
public static void WriteWithLabeledLocalTime(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithLabeledLocalTimeWithPassThrough(String, StreamWriter)
Call WriteWithLabeledLocalTime and write the message to the active Trace Listener or the supplied StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithLabeledLocalTimeWithPassThrough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |
WriteWithLabeledUTCTime(String, StreamWriter)
Write a time stamped trace log message, using the UTC machine time as its time stamp prefix.
Declaration
public static void WriteWithLabeledUTCTime(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithLabeledUTCTimeWithPassThrough(String, StreamWriter)
Call WriteWithLabeledUTCTime and write the message to the active Trace Listener or the supplied StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithLabeledUTCTimeWithPassThrough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |
WriteWithUnlabeledLocalTime(String, StreamWriter)
Write a time stamped trace log message, using the local machine time as its time stamp prefix.
Declaration
public static void WriteWithUnlabeledLocalTime(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithUnlabeledLocalTimeWithPassThrough(String, StreamWriter)
Call WriteWithUnlabeledLocalTime and write the message to the active Trace Listener or the supplied StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithUnlabeledLocalTimeWithPassThrough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |
WriteWithUnlabeledUTCTime(String, StreamWriter)
Write a time stamped trace log message, using the UTC machine time as its time stamp prefix.
Declaration
public static void WriteWithUnlabeledUTCTime(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
WriteWithUnlabeledUTCTimeWithPassThrough(String, StreamWriter)
Call WriteWithUnlabeledUTCTime and write the message to the active Trace Listener or the supplied StreamWriter, then return the message to the calling routine.
Declaration
public static string WriteWithUnlabeledUTCTimeWithPassThrough(string pstrMessage, StreamWriter psw = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pstrMessage | The specified string is written verbatim, immediately after the time stamp. |
StreamWriter | psw | When supplied, this StreamWriter takes the place of the Trace Listener. |
Returns
Type | Description |
---|---|
System.String | The return value is a copy of |