Log files

KissLog can be used to log files. This is useful when you need to:

  • Log large text messages which would normally be truncated

  • Save files which have been generated / processed throughout the request

  • Save response body

HomeController.cs
using KissLog.AspNetCore;

namespace AspNetCore5.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;
        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }

        public IActionResult Index()
        {
            _logger.LogAsFile("This content will be saved as a file", "File.txt");
            _logger.LogFile(@"C:\\Users\\Downloads\\cyber-receipt-16117.pdf", "cyber-receipt.pdf");
            _logger.LogResponseBody(true);

            return View();
        }
    }
}
Logged files
Previewing a logged file

For technical support, questions or any feedback, please feel free to send us a message and we will get back to you.