Created
January 24, 2026 13:57
-
-
Save wullemsb/d18fa9528414aee4fe45125296370c54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class UserService | |
| { | |
| private readonly ILogger<UserService> _logger; | |
| public UserService(ILogger<UserService>? logger = null) | |
| { | |
| _logger = logger ?? NullLogger<UserService>.Instance; | |
| } | |
| public void CreateUser(string username) | |
| { | |
| _logger.LogInformation("Creating user {Username}", username); | |
| // Do actual work... | |
| _logger.LogInformation("User {Username} created successfully", username); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment