Defines helper methods for generating log messages.
- Inheritance:
- object object
Methods
AppendNamedValues(string?, params object?[])
Creates a message with a list of key/value pairs that are automatically formatted.
Parameter | Type | Description |
---|---|---|
message | string | A message to be displayed before the list of values. |
args | object[] | The array of objects defining the keys and values as alternating entries (e.g. key0, value0, key1, value1). |
Returns
- string:
The list of key/value pairs.
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the arguments cannot be evenly divided into pairs. |
AppendNamedValues<TKey, TValue>(string?, ValueListStyle, IEnumerable<KeyValuePair<TKey, TValue>>)
Creates a message with a list of key/value pairs.
- Type Parameters:
-
TKey
-TValue
-
Parameter | Type | Description |
---|---|---|
message | string | A message to be displayed before the list of values. |
style | Value |
The style of list to be generated. |
keyValuePairs | IEnumerable<Key |
An IEnumerable<T> of KeyValuePair<TKey, TValue> to be listed. |
Returns
- string:
The list of key/value pairs.
AppendNamedValues<TKey, TValue>(string?, IEnumerable<KeyValuePair<TKey, TValue>>)
Creates a message with a list of key/value pairs using a style that is automatically determined.
- Type Parameters:
-
TKey
-TValue
-
Parameter | Type | Description |
---|---|---|
message | string | A message to be displayed before the list of values. |
keyValuePairs | IEnumerable<Key |
An IEnumerable<T> of KeyValuePair<TKey, TValue> to be listed. |
Returns
- string:
The list of key/value pairs.
CoerceAsKeyValuePairs(params object?[])
Coerces an array of objects into key-value pairs for every two objects in the array (e.g., first pair is index 0 and 1, second pair is index 2 and 3).
Parameter | Type | Description |
---|---|---|
args | object[] | The array of objects defining the keys and values as alternating entries (e.g. key0, value0, key1, value1). |
Returns
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the array cannot be evenly divided into pairs. |
CoerceAsString(object?)
Coerces the given value into a string for logging.
Parameter | Type | Description |
---|---|---|
value | object | The value to coerce. |
Returns
- string:
The coerced string value.
FormatStringWithNullTextReplacement(string?, params object?[])
Formats a message using string.Format(string, object?[])
after replacing any null
arguments with a placeholder string.
Parameter | Type | Description |
---|---|---|
message | string | The message to be formatted. |
args | object[] | The arguments. |
Returns
- string:
The formatted string.
MethodCall(object?, string, IEnumerable<KeyValuePair<string, object?>>)
Creates a message used to describe a method call.
Parameter | Type | Description |
---|---|---|
callerInstance | object | The instance of the caller object or |
callerMemberName | string | The name of the method that is called. |
argumentData | IEnumerable<Key |
An IEnumerable<T> of KeyValuePair<TKey, TValue> of relevant argument names and their values. |
Returns
- string:
A string describing the method call.
MethodCall(object?, string, params object?[])
Creates a message used to describe a method call.
Parameter | Type | Description |
---|---|---|
callerInstance | object | The instance of the caller object or |
callerMemberName | string | The name of the method that is called. |
argumentData | object[] | The array of objects defining relevant argument names and their values as alternating entries (e.g. arg0, value0, arg1, value1). |
Returns
- string:
A string describing the method call.
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the argument data cannot be evenly divided into pairs. |
NamedValues(params object?[])
Creates a message that is a list of key/value pairs using a style that is automatically determined.
Parameter | Type | Description |
---|---|---|
args | object[] | The array of objects defining the keys and values as alternating entries (e.g. key0, value0, key1, value1). |
Returns
- string:
The list of key/value pairs.
Exceptions
Type | Condition |
---|---|
Argument |
Thrown if the arguments cannot be evenly divided into pairs. |
NamedValues<TKey, TValue>(ValueListStyle, IEnumerable<KeyValuePair<TKey, TValue>>)
Creates a message that is a list of key/value pairs.
- Type Parameters:
-
TKey
-TValue
-
Parameter | Type | Description |
---|---|---|
style | Value |
The style of list to be generated. |
keyValuePairs | IEnumerable<Key |
An IEnumerable<T> of KeyValuePair<TKey, TValue> to be listed. |
Returns
- string:
The list of key/value pairs.
NamedValues<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>>)
Creates a message that is a list of key/value pairs using a style that is automatically determined.
- Type Parameters:
-
TKey
-TValue
-
Parameter | Type | Description |
---|---|---|
keyValuePairs | IEnumerable<Key |
An IEnumerable<T> of KeyValuePair<TKey, TValue> to be listed. |
Returns
- string:
The list of key/value pairs.