# Creating the LogService

Build a LogService that appends one time-stamped line per entry to a file named for the day, such as logs\\errors\\20260314.log. It asks for an IClock so tests can choose the date, and it never lets a logging problem crash the app.

![Cheat sheet: Creating the LogService](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/c6670679d35543268cc561cfaf1441f9.webp)

- Category: C#
- Level: Journeyman
- Tags: c-sharp, DateTime, Logging (c-sharp)
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/logging-exceptions-in-csharp-creating-the-logservice-cheat-sheet
