88using System . Security . Cryptography ;
99using System . Text ;
1010using GitHub . Primitives ;
11- using NLog ;
1211using Octokit ;
1312using Octokit . Reactive ;
1413using ReactiveUI ;
1817using System . Collections . Generic ;
1918using GitHub . Models ;
2019using GitHub . Extensions ;
20+ using GitHub . Logging ;
21+ using Serilog ;
2122
2223namespace GitHub . Api
2324{
2425 public partial class ApiClient : IApiClient
2526 {
2627 const string ScopesHeader = "X-OAuth-Scopes" ;
2728 const string ProductName = Info . ApplicationInfo . ApplicationDescription ;
28- static readonly Logger log = LogManager . GetCurrentClassLogger ( ) ;
29+ static readonly ILogger log = LogManager . ForContext < ApiClient > ( ) ;
2930
3031 readonly IObservableGitHubClient gitHubClient ;
3132 // There are two sets of authorization scopes, old and new:
@@ -187,7 +188,7 @@ static string GetSha256Hash(string input)
187188 }
188189 catch ( Exception e )
189190 {
190- log . Error ( "IMPOSSIBLE! Generating Sha256 hash caused an exception." , e ) ;
191+ log . Error ( e , "IMPOSSIBLE! Generating Sha256 hash caused an exception" ) ;
191192 return null ;
192193 }
193194 }
@@ -205,14 +206,14 @@ static string GetMachineNameSafe()
205206 }
206207 catch ( Exception e )
207208 {
208- log . Info ( "Failed to retrieve host name using `DNS.GetHostName`." , e ) ;
209+ log . Information ( e , "Failed to retrieve host name using `DNS.GetHostName`" ) ;
209210 try
210211 {
211212 return Environment . MachineName ;
212213 }
213214 catch ( Exception ex )
214215 {
215- log . Info ( "Failed to retrieve host name using `Environment.MachineName`." , ex ) ;
216+ log . Warning ( ex , "Failed to retrieve host name using `Environment.MachineName`" ) ;
216217 return "(unknown)" ;
217218 }
218219 }
@@ -233,7 +234,7 @@ static string GetMachineIdentifier()
233234 }
234235 catch ( Exception e )
235236 {
236- log . Info ( "Could not retrieve MAC address. Fallback to using machine name." , e ) ;
237+ log . Warning ( e , "Could not retrieve MAC address. Fallback to using machine name" ) ;
237238 return GetMachineNameSafe ( ) ;
238239 }
239240 }
0 commit comments