This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
GitHub.VisualStudio/Services Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ static Logger CreateLogger()
2020
2121 return new LoggerConfiguration ( )
2222 . Enrich . WithThreadId ( )
23+ #if DEBUG
24+ . MinimumLevel . Debug ( )
25+ #else
2326 . MinimumLevel . Information ( )
27+ #endif
2428 . WriteTo . File ( logPath ,
2529 fileSizeLimitBytes : null ,
2630 outputTemplate : outputTemplate )
Original file line number Diff line number Diff line change 88using GitHub . Helpers ;
99using GitHub . Models ;
1010using Task = System . Threading . Tasks . Task ;
11+ using GitHub . Logging ;
12+ using Serilog ;
1113
1214namespace GitHub . Services
1315{
1416 [ Export ( typeof ( IUsageService ) ) ]
1517 public class UsageService : IUsageService
1618 {
19+ static readonly ILogger log = LogManager . ForContext < UsageService > ( ) ;
1720 const string StoreFileName = "ghfvs.usage" ;
1821 static readonly Calendar cal = CultureInfo . InvariantCulture . Calendar ;
1922 readonly IGitHubServiceProvider serviceProvider ;
@@ -65,8 +68,9 @@ public async Task<UsageData> ReadLocalData()
6568 SimpleJson . DeserializeObject < UsageData > ( json ) :
6669 new UsageData { Model = new UsageModel ( ) } ;
6770 }
68- catch
71+ catch ( Exception ex )
6972 {
73+ log . Error ( ex , "Error deserializing usage" ) ;
7074 return new UsageData { Model = new UsageModel ( ) } ;
7175 }
7276 }
@@ -79,9 +83,9 @@ public async Task WriteLocalData(UsageData data)
7983 var json = SimpleJson . SerializeObject ( data ) ;
8084 await WriteAllTextAsync ( storePath , json ) ;
8185 }
82- catch
86+ catch ( Exception ex )
8387 {
84- // log.Warn( "Failed to write usage data", ex );
88+ log . Error ( ex , "Failed to write usage data" ) ;
8589 }
8690 }
8791
You can’t perform that action at this time.
0 commit comments