Skip to content

Commit

Permalink
Вывод логгера 1скрипт в лог приложения
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilBeaver committed Apr 10, 2022
1 parent 2ecde2a commit 825a4cd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/OneScript/Infrastructure/AppStarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public AppStarter(IFileProvider scripts, IApplicationRuntime webEng, IConfigurat
_scripts = scripts;
_webEng = webEng;
_logger = appLog;

SystemLogger.SetWriter(new StandardLogSystemLogWriter(_logger));

var configSection = config?.GetSection("OneScript");
var libRoot = configSection?["lib.system"];
Expand Down
21 changes: 21 additions & 0 deletions src/OneScript/Infrastructure/StandardLogSystemLogWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

using Microsoft.Extensions.Logging;
using ScriptEngine;

namespace OneScript.WebHost.Infrastructure
{
class StandardLogSystemLogWriter : ISystemLogWriter
{
private readonly ILogger _logger;

public StandardLogSystemLogWriter(ILogger logger)
{
_logger = logger;
}

public void Write(string text)
{
_logger.LogInformation(text);
}
}
}

0 comments on commit 825a4cd

Please sign in to comment.