2023-10-23 00:31:49 +00:00
|
|
|
using BotSharp.Abstraction.Evaluations;
|
2023-10-24 21:38:34 +00:00
|
|
|
using System.Text.RegularExpressions;
|
2023-10-23 00:31:49 +00:00
|
|
|
|
|
|
|
|
namespace BotSharp.Core.Evaluations;
|
|
|
|
|
|
|
|
|
|
public class ExecutionLogger : IExecutionLogger
|
|
|
|
|
{
|
|
|
|
|
private readonly IServiceProvider _services;
|
2025-02-20 17:59:59 +00:00
|
|
|
private readonly ILogger<ExecutionLogger> _logger;
|
|
|
|
|
|
2023-10-23 00:31:49 +00:00
|
|
|
public ExecutionLogger(
|
2025-02-20 17:59:59 +00:00
|
|
|
IServiceProvider services,
|
|
|
|
|
ILogger<ExecutionLogger> logger)
|
2023-10-23 00:31:49 +00:00
|
|
|
{
|
|
|
|
|
_services = services;
|
2025-02-20 17:59:59 +00:00
|
|
|
_logger = logger;
|
2023-10-23 00:31:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Append(string conversationId, string content)
|
|
|
|
|
{
|
2023-10-24 21:38:34 +00:00
|
|
|
content = content.Replace("\r\n", " ").Replace("\n", " ");
|
|
|
|
|
content = Regex.Replace(content, @"\s+", " ");
|
2025-02-20 17:59:59 +00:00
|
|
|
_logger.LogInformation($"Execution Log: {content}");
|
2023-10-23 00:31:49 +00:00
|
|
|
}
|
|
|
|
|
}
|