47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
// Copyright (c) 2021 Informatikbüro Daniel Schick
|
|
|
|
using System;
|
|
using System.Text;
|
|
|
|
using log4net;
|
|
using MailKit;
|
|
|
|
namespace bsmd.email
|
|
{
|
|
/// <summary>
|
|
/// this class sends MailKit Log messages to Log4Net (hopefully :D)
|
|
/// </summary>
|
|
internal class MailKitLogger : IProtocolLogger
|
|
{
|
|
private readonly ILog _log = LogManager.GetLogger(typeof(BSMDImapClient));
|
|
|
|
public void Dispose()
|
|
{
|
|
|
|
// cleanup is done somewhere else
|
|
}
|
|
|
|
/// <summary>
|
|
/// keine Ahnung was das macht
|
|
/// </summary>
|
|
public IAuthenticationSecretDetector AuthenticationSecretDetector { get; set; }
|
|
|
|
public void LogClient(byte[] buffer, int offset, int count)
|
|
{
|
|
string logString = Encoding.Default.GetString(buffer, offset, count);
|
|
_log.DebugFormat("C: {0}", logString);
|
|
}
|
|
|
|
public void LogConnect(Uri uri)
|
|
{
|
|
_log.DebugFormat("Connecting to {0}", uri);
|
|
}
|
|
|
|
public void LogServer(byte[] buffer, int offset, int count)
|
|
{
|
|
string logString = Encoding.Default.GetString(buffer, offset, count);
|
|
_log.DebugFormat("S: {0}", logString);
|
|
}
|
|
}
|
|
}
|