-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend logging and verbosity options (#2693)
* First stab at logging. --verbosity d should be the same as in the past --verbosity n should be pretty quiet * Make use of Serilog * improve test specificity * add log messages about count of processed files * Use interpolated strings for all logger functions. Change some logs to be error logs.
- Loading branch information
Showing
11 changed files
with
183 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Fantomas.Logging | ||
|
||
open Serilog | ||
|
||
[<RequireQualifiedAccess>] | ||
type VerbosityLevel = | ||
| Normal | ||
| Detailed | ||
|
||
let private logger = | ||
Log.Logger <- LoggerConfiguration().WriteTo.Console().CreateLogger() | ||
Log.Logger | ||
|
||
/// log a message | ||
let stdlog (s: string) = logger.Information(s) | ||
|
||
/// log an error | ||
let elog (s: string) = logger.Error(s) | ||
|
||
/// log a message if the verbosity level is >= Detailed | ||
let logGrEqDetailed verbosity s = | ||
if verbosity = VerbosityLevel.Detailed then | ||
logger.Information(s) | ||
else | ||
() | ||
|
||
let closeAndFlushLog () = Log.CloseAndFlush() |
Oops, something went wrong.