-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.Authors.cs
More file actions
121 lines (105 loc) · 4.45 KB
/
Log.Authors.cs
File metadata and controls
121 lines (105 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using Microsoft.Extensions.Logging;
namespace BookStore.ApiService.Infrastructure.Logging;
/// <summary>
/// Author-related log messages for CRUD operations and validation.
/// </summary>
public static partial class Log
{
public static partial class Authors
{
// Creation
[LoggerMessage(
Level = LogLevel.Information,
Message = "Creating author: Id={AuthorId}, Name={Name}, CorrelationId={CorrelationId}")]
public static partial void AuthorCreating(
ILogger logger,
Guid authorId,
string name,
string correlationId);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Author created successfully: Id={AuthorId}, Name={Name}")]
public static partial void AuthorCreated(
ILogger logger,
Guid authorId,
string name);
// Update
[LoggerMessage(
Level = LogLevel.Information,
Message = "Updating author: Id={AuthorId}, Name={Name}, Version={Version}")]
public static partial void AuthorUpdating(
ILogger logger,
Guid authorId,
string name,
long version);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Author updated successfully: Id={AuthorId}")]
public static partial void AuthorUpdated(ILogger logger, Guid authorId);
// Soft Delete
[LoggerMessage(
Level = LogLevel.Information,
Message = "Soft deleting author: Id={AuthorId}")]
public static partial void AuthorSoftDeleting(ILogger logger, Guid authorId);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Author soft deleted successfully: Id={AuthorId}")]
public static partial void AuthorSoftDeleted(ILogger logger, Guid authorId);
// Restore
[LoggerMessage(
Level = LogLevel.Information,
Message = "Restoring author: Id={AuthorId}")]
public static partial void AuthorRestoring(ILogger logger, Guid authorId);
[LoggerMessage(
Level = LogLevel.Information,
Message = "Author restored successfully: Id={AuthorId}")]
public static partial void AuthorRestored(ILogger logger, Guid authorId);
// Validation Errors
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Invalid translation language codes for author: AuthorId={AuthorId}, InvalidCodes={InvalidCodes}")]
public static partial void InvalidTranslationCodes(
ILogger logger,
Guid authorId,
string invalidCodes);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Missing default language translation for author: AuthorId={AuthorId}, DefaultLanguage={DefaultLanguage}")]
public static partial void MissingDefaultTranslation(
ILogger logger,
Guid authorId,
string defaultLanguage);
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Biography too long for author: AuthorId={AuthorId}, LanguageCode={LanguageCode}, MaxLength={MaxLength}, ActualLength={ActualLength}")]
public static partial void BiographyTooLong(
ILogger logger,
Guid authorId,
string languageCode,
int maxLength,
int actualLength);
// ETag Validation
[LoggerMessage(
Level = LogLevel.Warning,
Message = "ETag mismatch for author: Id={AuthorId}, Expected={ExpectedETag}, Provided={ProvidedETag}")]
public static partial void ETagMismatch(
ILogger logger,
Guid authorId,
string expectedETag,
string providedETag);
// Not Found
[LoggerMessage(
Level = LogLevel.Warning,
Message = "Author not found: Id={AuthorId}")]
public static partial void AuthorNotFound(ILogger logger, Guid authorId);
// Query Operations
[LoggerMessage(
Level = LogLevel.Debug,
Message = "Retrieving author: Id={AuthorId}")]
public static partial void RetrievingAuthor(ILogger logger, Guid authorId);
[LoggerMessage(
Level = LogLevel.Debug,
Message = "Listing authors: Page={Page}, PageSize={PageSize}")]
public static partial void ListingAuthors(ILogger logger, int page, int pageSize);
}
}