12
12
using AttackSurfaceAnalyzer . Utils ;
13
13
using Microsoft . Data . Sqlite ;
14
14
using Newtonsoft . Json ;
15
+ using Serilog ;
15
16
16
17
namespace AttackSurfaceAnalyzer . Collectors . FileSystem
17
18
{
@@ -51,7 +52,7 @@ public void WriteUntilEmpty()
51
52
CommitTimer . Enabled = false ;
52
53
while ( _queue . Count > 0 )
53
54
{
54
- Logger . Instance . Warn ( _queue . Count ) ;
55
+ Log . Warning ( _queue . Count . ToString ( ) ) ;
55
56
FileSystemObject fso = _queue . Dequeue ( ) ;
56
57
Write ( cmd , fso ) ;
57
58
}
@@ -75,9 +76,9 @@ public void Write(SqliteCommand cmd, FileSystemObject obj)
75
76
}
76
77
catch ( Exception e )
77
78
{
78
- Logger . Instance . Info ( e . StackTrace ) ;
79
- Logger . Instance . Info ( e . Message ) ;
80
- Logger . Instance . Info ( e . GetType ( ) ) ;
79
+ Log . Information ( e . StackTrace ) ;
80
+ Log . Information ( e . Message ) ;
81
+ Log . Information ( e . GetType ( ) . ToString ( ) ) ;
81
82
}
82
83
}
83
84
@@ -120,9 +121,9 @@ public void Write(FileSystemObject obj)
120
121
}
121
122
catch ( Exception e )
122
123
{
123
- Logger . Instance . Info ( e . StackTrace ) ;
124
- Logger . Instance . Info ( e . Message ) ;
125
- Logger . Instance . Info ( e . GetType ( ) ) ;
124
+ Log . Information ( e . StackTrace ) ;
125
+ Log . Information ( e . Message ) ;
126
+ Log . Information ( e . GetType ( ) . ToString ( ) ) ;
126
127
}
127
128
}
128
129
@@ -172,9 +173,9 @@ public override bool CanRunOnPlatform()
172
173
// }
173
174
// catch (Exception e)
174
175
// {
175
- // Logger.Instance.Info (e.StackTrace);
176
- // Logger.Instance.Info (e.Message);
177
- // Logger.Instance.Info (e.GetType());
176
+ // Log.Information (e.StackTrace);
177
+ // Log.Information (e.Message);
178
+ // Log.Information (e.GetType());
178
179
// }
179
180
//}
180
181
@@ -216,7 +217,7 @@ public override void Execute()
216
217
217
218
foreach ( var root in this . roots )
218
219
{
219
- Logger . Instance . Warn ( "Scanning root " + root . ToString ( ) ) ;
220
+ Log . Warning ( "Scanning root " + root . ToString ( ) ) ;
220
221
try
221
222
{
222
223
var fileInfoEnumerable = DirectoryWalker . WalkDirectory ( root ) ;
@@ -251,13 +252,13 @@ public override void Execute()
251
252
}
252
253
catch ( Exception ex )
253
254
{
254
- Logger . Instance . Debug ( ex , "Error processing {0}" , fileInfo ? . FullName ) ;
255
+ Log . Debug ( ex , "Error processing {0}" , fileInfo ? . FullName ) ;
255
256
}
256
257
} ) ) ;
257
258
}
258
259
catch ( Exception ex )
259
260
{
260
- Logger . Instance . Debug ( ex , "Error collecting file system information: {0}" , ex . Message ) ;
261
+ Log . Debug ( ex , "Error collecting file system information: {0}" , ex . Message ) ;
261
262
}
262
263
}
263
264
@@ -270,8 +271,8 @@ public override void Execute()
270
271
t . Minutes ,
271
272
t . Seconds ,
272
273
t . Milliseconds ) ;
273
- Logger . Instance . Info ( "Completed FileSystemCollector in " + answer ) ;
274
- Logger . Instance . Info ( "Flushing data" ) ;
274
+ Log . Information ( "Completed FileSystemCollector in " + answer ) ;
275
+ Log . Information ( "Flushing data" ) ;
275
276
watch = System . Diagnostics . Stopwatch . StartNew ( ) ;
276
277
277
278
DatabaseManager . Commit ( ) ;
@@ -283,7 +284,7 @@ public override void Execute()
283
284
t . Minutes ,
284
285
t . Seconds ,
285
286
t . Milliseconds ) ;
286
- Logger . Instance . Info ( "Flush completed in " + answer ) ;
287
+ Log . Information ( "Flush completed in " + answer ) ;
287
288
}
288
289
}
289
290
}
0 commit comments