/// Gets or sets the <see cref="T:Duplicati.Library.Logging.LogEntry"/> with the specified value.
/// </summary>
/// <param name="value">The key to use.</param>
publicstringthis[stringkey]
{
get
{
if(m_logContext==null)
returnnull;
m_logContext.TryGetValue(key,outvars);
returns;
}
set
{
if(m_logContext==null)
m_logContext=newDictionary<string,string>();
m_logContext[key]=value;
}
}
/// <summary>
/// Gets the keys in this log context
/// </summary>
/// <value>The context keys.</value>
publicIEnumerable<string>ContextKeys
{
get
{
if(m_logContext==null)
returnnewstring[0];
returnm_logContext.Keys;
}
}
/// <summary>
/// Gets the message, formatted with arguments
/// </summary>
/// <value>The formatted message.</value>
publicstringFormattedMessage
{
get
{
if(Arguments==null||Arguments.Length==0)
returnMessage;
try
{
returnstring.Format(Message,Arguments);
}
catch
{
// Try no to crash ...
returnstring.Format("Error while formating: \"{0}\" with arguments: [{1}]",Message,string.Join(", ",Arguments.Select(x=>x==null?"(null)":x.ToString())));
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="T:Duplicati.Library.Logging.LogEntry"/> class.
/// </summary>
/// <param name="message">The message to use.</param>
/// <param name="arguments">An optional set of arguments.</param>