Esempio n. 1
0
    public async Task AddLogAsync(LaobianLog log, CancellationToken cancellationToken = default)
    {
        var site = LaobianSite.Api;

        if (Enum.TryParse(log.LoggerName, true, out LaobianSite temp))
        {
            site = temp;
        }

        await _logFileRepository.AppendLineAsync(
            Path.Combine(site.ToString().ToLowerInvariant(), log.TimeStamp.Year.ToString("D4"),
                         $"{log.TimeStamp.ToDate()}.log"), JsonUtil.Serialize(log), cancellationToken);
    }