Show / Hide Table of Contents

Class TraceLogger

This static class exposes methods that support every conceivable combination of local and UTC time stamps for trace logging.

Inheritance
System.Object
TraceLogger
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 Source

ForceAutoFlush(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 psw is already set to AutoFlush mode. Otherwise, the mode is set, and the return value is False, to indicate that it wasn't set on entry.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 pstrMessage.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX