Skip to content

Commit fff84f8

Browse files
committed
Log message cleanup
1 parent e15a517 commit fff84f8

27 files changed

+88
-88
lines changed

src/Exceptionless.Core/Bootstrapper.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,16 @@ public static void LogConfiguration(IServiceProvider serviceProvider, AppOptions
199199
return;
200200

201201
if (String.IsNullOrEmpty(appOptions.CacheOptions.Provider))
202-
logger.LogWarning("Distributed cache is NOT enabled on {MachineName}.", Environment.MachineName);
202+
logger.LogWarning("Distributed cache is NOT enabled on {MachineName}", Environment.MachineName);
203203

204204
if (String.IsNullOrEmpty(appOptions.MessageBusOptions.Provider))
205-
logger.LogWarning("Distributed message bus is NOT enabled on {MachineName}.", Environment.MachineName);
205+
logger.LogWarning("Distributed message bus is NOT enabled on {MachineName}", Environment.MachineName);
206206

207207
if (String.IsNullOrEmpty(appOptions.QueueOptions.Provider))
208-
logger.LogWarning("Distributed queue is NOT enabled on {MachineName}.", Environment.MachineName);
208+
logger.LogWarning("Distributed queue is NOT enabled on {MachineName}", Environment.MachineName);
209209

210210
if (String.IsNullOrEmpty(appOptions.StorageOptions.Provider))
211-
logger.LogWarning("Distributed storage is NOT enabled on {MachineName}.", Environment.MachineName);
211+
logger.LogWarning("Distributed storage is NOT enabled on {MachineName}", Environment.MachineName);
212212

213213
if (!appOptions.EnableWebSockets)
214214
logger.LogWarning("Web Sockets is NOT enabled on {MachineName}", Environment.MachineName);
@@ -268,7 +268,7 @@ public static void AddHostedJobs(IServiceCollection services, ILoggerFactory log
268268
services.AddCronJob<MaintainIndexesJob>("10 */2 * * *");
269269

270270
var logger = loggerFactory.CreateLogger<Bootstrapper>();
271-
logger.LogWarning("Jobs running in process.");
271+
logger.LogWarning("Jobs running in process");
272272
}
273273

274274
public static DynamicTypeContractResolver GetJsonContractResolver()

src/Exceptionless.Core/Jobs/DailySummaryJob.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,23 +124,23 @@ private async Task<bool> SendSummaryNotificationAsync(Project project, SummaryNo
124124
var userIds = project.NotificationSettings.Where(n => n.Value.SendDailySummary && !String.Equals(n.Key, Project.NotificationIntegrations.Slack)).Select(n => n.Key).ToList();
125125
if (userIds.Count == 0)
126126
{
127-
_logger.LogInformation("Project {ProjectName} has no users to send summary to.", project.Name);
127+
_logger.LogInformation("Project {ProjectName} has no users to send summary to", project.Name);
128128
return false;
129129
}
130130

131131
var results = await _userRepository.GetByIdsAsync(userIds, o => o.Cache());
132132
var users = results.Where(u => u.IsEmailAddressVerified && u.EmailNotificationsEnabled && u.OrganizationIds.Contains(project.OrganizationId)).ToList();
133133
if (users.Count == 0)
134134
{
135-
_logger.LogInformation("Project {ProjectName} has no users to send summary to.", project.Name);
135+
_logger.LogInformation("Project {ProjectName} has no users to send summary to", project.Name);
136136
return false;
137137
}
138138

139139
// TODO: What should we do about suspended organizations.
140140
var organization = await _organizationRepository.GetByIdAsync(project.OrganizationId, o => o.Cache());
141141
if (organization is null)
142142
{
143-
_logger.LogInformation("The organization {organization} for project {ProjectName} may have been deleted. No summaries will be sent.", project.OrganizationId, project.Name);
143+
_logger.LogInformation("The organization {organization} for project {ProjectName} may have been deleted. No summaries will be sent", project.OrganizationId, project.Name);
144144
return false;
145145
}
146146

@@ -176,7 +176,7 @@ private async Task<bool> SendSummaryNotificationAsync(Project project, SummaryNo
176176

177177
foreach (var user in users)
178178
{
179-
_logger.LogInformation("Queuing {ProjectName} daily summary email ({UtcStartTime}-{UtcEndTime}) for user {EmailAddress}.", project.Name, data.UtcStartTime, data.UtcEndTime, user.EmailAddress);
179+
_logger.LogInformation("Queuing {ProjectName} daily summary email ({UtcStartTime}-{UtcEndTime}) for user {EmailAddress}", project.Name, data.UtcStartTime, data.UtcEndTime, user.EmailAddress);
180180
await _mailer.SendProjectDailySummaryAsync(user, project, mostFrequent, newest, data.UtcStartTime, hasSubmittedEvents, total, uniqueTotal, newTotal, fixedTotal, blockedTotal, tooBigTotal, isFreePlan);
181181
}
182182

src/Exceptionless.Core/Jobs/DownloadGeoIPDatabaseJob.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected override async Task<JobResult> RunInternalAsync(JobContext context)
3838
string? licenseKey = _options.MaxMindGeoIpKey;
3939
if (String.IsNullOrEmpty(licenseKey))
4040
{
41-
_logger.LogInformation("Configure {SettingKey} to download GeoIP database.", nameof(AppOptions.MaxMindGeoIpKey));
41+
_logger.LogInformation("Configure {SettingKey} to download GeoIP database", nameof(AppOptions.MaxMindGeoIpKey));
4242
return JobResult.Success;
4343
}
4444

@@ -47,11 +47,11 @@ protected override async Task<JobResult> RunInternalAsync(JobContext context)
4747
var fi = await _storage.GetFileInfoAsync(GEO_IP_DATABASE_PATH);
4848
if (fi is not null && fi.Modified.IsAfter(SystemClock.UtcNow.StartOfDay()))
4949
{
50-
_logger.LogInformation("The GeoIP database is already up-to-date.");
50+
_logger.LogInformation("The GeoIP database is already up-to-date");
5151
return JobResult.Success;
5252
}
5353

54-
_logger.LogInformation("Downloading GeoIP database.");
54+
_logger.LogInformation("Downloading GeoIP database");
5555
var client = new HttpClient();
5656
string url = $"https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key={licenseKey}&suffix=tar.gz";
5757
var file = await client.GetAsync(url, context.CancellationToken);
@@ -64,11 +64,11 @@ protected override async Task<JobResult> RunInternalAsync(JobContext context)
6464
}
6565
catch (Exception ex)
6666
{
67-
_logger.LogError(ex, "An error occurred while downloading the GeoIP database.");
67+
_logger.LogError(ex, "An error occurred while downloading the GeoIP database");
6868
return JobResult.FromException(ex);
6969
}
7070

71-
_logger.LogInformation("Finished downloading GeoIP database.");
71+
_logger.LogInformation("Finished downloading GeoIP database");
7272
return JobResult.Success;
7373
}
7474

src/Exceptionless.Core/Jobs/EventNotificationsJob.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected override async Task<JobResult> ProcessQueueEntryAsync(QueueEntryContex
111111
if (info is not null && info.Device.IsSpider || request.UserAgent.AnyWildcardMatches(botPatterns))
112112
{
113113
shouldReport = false;
114-
if (shouldLog) _logger.LogInformation("Skipping because event is from a bot {UserAgent}.", request.UserAgent);
114+
if (shouldLog) _logger.LogInformation("Skipping because event is from a bot {UserAgent}", request.UserAgent);
115115
}
116116
}
117117

@@ -146,19 +146,19 @@ private async Task<bool> SendEmailNotificationAsync(string userId, Project proje
146146
var user = await _userRepository.GetByIdAsync(userId, o => o.Cache());
147147
if (String.IsNullOrEmpty(user?.EmailAddress))
148148
{
149-
if (shouldLog) _logger.LogError("Could not load user {UserId} or blank email address {EmailAddress}.", userId, user?.EmailAddress ?? "");
149+
if (shouldLog) _logger.LogError("Could not load user {UserId} or blank email address {EmailAddress}", userId, user?.EmailAddress ?? "");
150150
return false;
151151
}
152152

153153
if (!user.IsEmailAddressVerified)
154154
{
155-
if (shouldLog) _logger.LogInformation("User {UserId} with email address {EmailAddress} has not been verified.", user.Id, user.EmailAddress);
155+
if (shouldLog) _logger.LogInformation("User {UserId} with email address {EmailAddress} has not been verified", user.Id, user.EmailAddress);
156156
return false;
157157
}
158158

159159
if (!user.EmailNotificationsEnabled)
160160
{
161-
if (shouldLog) _logger.LogInformation("User {UserId} with email address {EmailAddress} has email notifications disabled.", user.Id, user.EmailAddress);
161+
if (shouldLog) _logger.LogInformation("User {UserId} with email address {EmailAddress} has email notifications disabled", user.Id, user.EmailAddress);
162162
return false;
163163
}
164164

@@ -173,7 +173,7 @@ private async Task<bool> SendEmailNotificationAsync(string userId, Project proje
173173
// don't send notifications in non-production mode to email addresses that are not on the outbound email list.
174174
if (_appOptions.AppMode != AppMode.Production && !_emailOptions.AllowedOutboundAddresses.Contains(v => user.EmailAddress.Contains(v, StringComparison.InvariantCultureIgnoreCase)))
175175
{
176-
if (shouldLog) _logger.LogInformation("Skipping because email is not on the outbound list and not in production mode.");
176+
if (shouldLog) _logger.LogInformation("Skipping because email is not on the outbound list and not in production mode");
177177
return false;
178178
}
179179

src/Exceptionless.Core/Jobs/EventPostsJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,11 @@ private Task CompleteEntryAsync(IQueueEntry<EventPost> entry, EventPostInfo even
345345

346346
protected override void LogProcessingQueueEntry(IQueueEntry<EventPost> entry)
347347
{
348-
_logger.LogDebug("Processing {QueueEntryName} queue entry ({QueueEntryId}).", _queueEntryName, entry.Id);
348+
_logger.LogDebug("Processing {QueueEntryName} queue entry ({QueueEntryId})", _queueEntryName, entry.Id);
349349
}
350350

351351
protected override void LogAutoCompletedQueueEntry(IQueueEntry<EventPost> entry)
352352
{
353-
_logger.LogDebug("Auto completed {QueueEntryName} queue entry ({QueueEntryId}).", _queueEntryName, entry.Id);
353+
_logger.LogDebug("Auto completed {QueueEntryName} queue entry ({QueueEntryId})", _queueEntryName, entry.Id);
354354
}
355355
}

src/Exceptionless.Core/Jobs/MailMessageJob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public MailMessageJob(IQueue<MailMessage> queue, IMailSender mailSender, ILogger
1818

1919
protected override async Task<JobResult> ProcessQueueEntryAsync(QueueEntryContext<MailMessage> context)
2020
{
21-
_logger.LogTrace("Processing message {Id}.", context.QueueEntry.Id);
21+
_logger.LogTrace("Processing message {Id}", context.QueueEntry.Id);
2222

2323
try
2424
{

src/Exceptionless.Core/Jobs/StackEventCountJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ protected override Task<ILock> GetLockAsync(CancellationToken cancellationToken
2929
protected override async Task<JobResult> RunInternalAsync(JobContext context)
3030
{
3131
_lastRun = SystemClock.UtcNow;
32-
_logger.LogTrace("Start save stack event counts.");
32+
_logger.LogTrace("Start save stack event counts");
3333
await _stackService.SaveStackUsagesAsync(cancellationToken: context.CancellationToken);
34-
_logger.LogTrace("Finished save stack event counts.");
34+
_logger.LogTrace("Finished save stack event counts");
3535
return JobResult.Success;
3636
}
3737

src/Exceptionless.Core/Jobs/StackStatusJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected override async Task<JobResult> RunInternalAsync(JobContext context)
3232
{
3333
const int LIMIT = 100;
3434
_lastRun = SystemClock.UtcNow;
35-
_logger.LogTrace("Start save stack event counts.");
35+
_logger.LogTrace("Start save stack event counts");
3636

3737
// Get list of stacks where snooze has expired
3838
var results = await _stackRepository.GetExpiredSnoozedStatuses(SystemClock.UtcNow, o => o.PageLimit(LIMIT));
@@ -53,7 +53,7 @@ protected override async Task<JobResult> RunInternalAsync(JobContext context)
5353
await context.RenewLockAsync();
5454
}
5555

56-
_logger.LogTrace("Finished save stack event counts.");
56+
_logger.LogTrace("Finished save stack event counts");
5757
return JobResult.Success;
5858
}
5959

src/Exceptionless.Core/Jobs/WorkItemHandlers/OrganizationNotificationWorkItemHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ private async Task SendOverageNotificationsAsync(Organization organization, bool
8383
{
8484
if (!user.IsEmailAddressVerified)
8585
{
86-
Log.LogInformation("User {UserId} with email address {EmailAddress} has not been verified.", user.Id, user.EmailAddress);
86+
Log.LogInformation("User {UserId} with email address {EmailAddress} has not been verified", user.Id, user.EmailAddress);
8787
continue;
8888
}
8989

9090
if (!user.EmailNotificationsEnabled)
9191
{
92-
Log.LogInformation("User {UserId} with email address {EmailAddress} has email notifications disabled.", user.Id, user.EmailAddress);
92+
Log.LogInformation("User {UserId} with email address {EmailAddress} has email notifications disabled", user.Id, user.EmailAddress);
9393
continue;
9494
}
9595

9696
Log.LogTrace("Sending email to {EmailAddress}...", user.EmailAddress);
9797
await _mailer.SendOrganizationNoticeAsync(user, organization, isOverMonthlyLimit, isOverHourlyLimit);
9898
}
9999

100-
Log.LogTrace("Done sending email.");
100+
Log.LogTrace("Done sending email");
101101
}
102102
}

src/Exceptionless.Core/Pipeline/001_CheckEventDateAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public override Task ProcessAsync(EventContext ctx)
2323
double eventAgeInDays = SystemClock.UtcNow.Subtract(ctx.Event.Date.UtcDateTime).TotalDays;
2424
if (eventAgeInDays > 3 || ctx.Organization.RetentionDays > 0 && eventAgeInDays > ctx.Organization.RetentionDays)
2525
{
26-
_logger.LogInformation("Discarding event that occurred more than three days ago or outside of organization retention limit.");
26+
_logger.LogInformation("Discarding event that occurred more than three days ago or outside of organization retention limit");
2727

2828
ctx.IsCancelled = true;
2929
ctx.IsDiscarded = true;

0 commit comments

Comments
 (0)