Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit b568332

Browse files
authored
Merge pull request #1472 from github/fixes/log-at-correct-levels
Log things at appropriate levels
2 parents 855a566 + 542966a commit b568332

File tree

5 files changed

+13
-17
lines changed

5 files changed

+13
-17
lines changed

src/GitHub.App/Api/ApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static string GetMachineNameSafe()
157157
}
158158
catch (Exception e)
159159
{
160-
log.Information(e, "Failed to retrieve host name using `DNS.GetHostName`");
160+
log.Warning(e, "Failed to retrieve host name using `DNS.GetHostName`");
161161
try
162162
{
163163
return Environment.MachineName;

src/GitHub.App/Services/TeamExplorerContext.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void Refresh()
6565
{
6666
// Ignore when ActiveRepositories is empty and solution hasn't changed.
6767
// https://github.com/github/VisualStudio/issues/1421
68-
log.Information("Ignoring no ActiveRepository when solution hasn't changed");
68+
log.Debug("Ignoring no ActiveRepository when solution hasn't changed");
6969
}
7070
else
7171
{
@@ -76,22 +76,22 @@ void Refresh()
7676

7777
if (newRepositoryPath != repositoryPath)
7878
{
79-
log.Information("Fire PropertyChanged event for ActiveRepository");
79+
log.Debug("Fire PropertyChanged event for ActiveRepository");
8080
ActiveRepository = repo;
8181
}
8282
else if (newBranchName != branchName)
8383
{
84-
log.Information("Fire StatusChanged event when BranchName changes for ActiveRepository");
84+
log.Debug("Fire StatusChanged event when BranchName changes for ActiveRepository");
8585
StatusChanged?.Invoke(this, EventArgs.Empty);
8686
}
8787
else if (newHeadSha != headSha)
8888
{
89-
log.Information("Fire StatusChanged event when HeadSha changes for ActiveRepository");
89+
log.Debug("Fire StatusChanged event when HeadSha changes for ActiveRepository");
9090
StatusChanged?.Invoke(this, EventArgs.Empty);
9191
}
9292
else if (newTrackedSha != trackedSha)
9393
{
94-
log.Information("Fire StatusChanged event when TrackedSha changes for ActiveRepository");
94+
log.Debug("Fire StatusChanged event when TrackedSha changes for ActiveRepository");
9595
StatusChanged?.Invoke(this, EventArgs.Empty);
9696
}
9797

src/GitHub.App/ViewModels/Dialog/LoginTabViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void HandleError(Exception ex)
200200

201201
if (ex.IsCriticalException()) return;
202202

203-
log.Information(ex, "Error logging into '{BaseUri}' as '{UsernameOrEmail}'", BaseUri, UsernameOrEmail);
203+
log.Error(ex, "Error logging into '{BaseUri}' as '{UsernameOrEmail}'", BaseUri, UsernameOrEmail);
204204
if (ex is Octokit.ForbiddenException)
205205
{
206206
Error = new UserError(Resources.LoginFailedForbiddenMessage, ex.Message);

src/GitHub.TeamFoundation.14/Connect/GitHubConnectSection.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,7 @@ void ShowNotification(ILocalRepositoryModel newrepo, string msg)
360360
}
361361
})
362362
);
363-
#if DEBUG
364-
log.Information("Notification");
365-
#endif
363+
log.Debug("Notification");
366364
}
367365

368366
async Task RefreshRepositories()
@@ -496,12 +494,10 @@ void TrackState(object sender, PropertyChangedEventArgs e)
496494
{
497495
if (machine.PermittedTriggers.Contains(e.PropertyName))
498496
{
499-
#if DEBUG
500-
log.Information("{PropertyName} title:{Title} busy:{IsBusy}",
497+
log.Debug("{PropertyName} title:{Title} busy:{IsBusy}",
501498
e.PropertyName,
502499
((ITeamExplorerSection)sender).Title,
503500
((ITeamExplorerSection)sender).IsBusy);
504-
#endif
505501
machine.Fire(e.PropertyName);
506502
}
507503
}

src/GitHub.TeamFoundation.14/Services/VSGitExt.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public VSGitExt(IGitHubServiceProvider serviceProvider, IVSUIContextFactory fact
5555
{
5656
// If we're not in the UIContext or TryInitialize fails, have another go when the UIContext changes.
5757
context.UIContextChanged += ContextChanged;
58-
log.Information("VSGitExt will be initialized later");
58+
log.Debug("VSGitExt will be initialized later");
5959
InitializeTask = Task.CompletedTask;
6060
}
6161
}
@@ -69,7 +69,7 @@ void ContextChanged(object sender, VSUIContextChangedEventArgs e)
6969
// Refresh ActiveRepositories on background thread so we don't delay UI context change.
7070
InitializeTask = Task.Run(() => RefreshActiveRepositories());
7171
context.UIContextChanged -= ContextChanged;
72-
log.Information("Initialized VSGitExt on UIContextChanged");
72+
log.Debug("Initialized VSGitExt on UIContextChanged");
7373
}
7474
}
7575

@@ -86,11 +86,11 @@ bool TryInitialize()
8686
}
8787
};
8888

89-
log.Information("Found IGitExt service and initialized VSGitExt");
89+
log.Debug("Found IGitExt service and initialized VSGitExt");
9090
return true;
9191
}
9292

93-
log.Information("Couldn't find IGitExt service");
93+
log.Error("Couldn't find IGitExt service");
9494
return false;
9595
}
9696

0 commit comments

Comments
 (0)