Skip to content

Commit c56be94

Browse files
committed
format tests
1 parent 21cb034 commit c56be94

File tree

7 files changed

+2192
-1231
lines changed

7 files changed

+2192
-1231
lines changed

.fantomasignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
test/
1+
test/examples
22
obj/**/*.fs

.gitattributes

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
*.doc diff=astextplain
2-
*.DOC diff=astextplain
3-
*.docx diff=astextplain
4-
*.DOCX diff=astextplain
5-
*.dot diff=astextplain
6-
*.DOT diff=astextplain
7-
*.pdf diff=astextplain
8-
*.PDF diff=astextplain
9-
*.rtf diff=astextplain
10-
*.RTF diff=astextplain
1+
*.doc diff=astextplain
2+
*.DOC diff=astextplain
3+
*.docx diff=astextplain
4+
*.DOCX diff=astextplain
5+
*.dot diff=astextplain
6+
*.DOT diff=astextplain
7+
*.pdf diff=astextplain
8+
*.PDF diff=astextplain
9+
*.rtf diff=astextplain
10+
*.RTF diff=astextplain
1111

12-
*.jpg binary
13-
*.png binary
14-
*.gif binary
12+
*.jpg binary
13+
*.png binary
14+
*.gif binary
1515

1616
*.sh eol=lf
1717

18-
*.cs text=auto diff=csharp
19-
*.vb text=auto
18+
*.cs text=auto diff=csharp ol=lf
19+
*.vb text=auto diff=csharp ol=lf
2020
*.resx text=auto
2121
*.c text=auto
2222
*.cpp text=auto
@@ -41,12 +41,12 @@
4141
*.m text=auto
4242
*.asm text=auto
4343
*.erl text=auto
44-
*.fs text=auto
45-
*.fsx text=auto
44+
*.fs text=auto diff=csharp ol=lf
45+
*.fsx text=auto diff=csharp ol=lf
4646
*.hs text=auto
4747

4848
*.csproj text=auto
4949
*.vbproj text=auto
5050
*.fsproj text=auto
5151
*.dbproj text=auto
52-
*.sln text=auto eol=crlf
52+
*.sln text=auto eol=crlf

src/Ionide.ProjInfo/FsLibLog.fs

+44-48
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ module Types =
2828

2929
/// Type representing a Log
3030
[<NoEquality; NoComparison>]
31-
type Log =
32-
{
33-
LogLevel: LogLevel
34-
Message: MessageThunk
35-
Exception: exn option
36-
Parameters: obj list
37-
AdditionalNamedParameters: ((string * obj * bool) list)
38-
}
31+
type Log = {
32+
LogLevel: LogLevel
33+
Message: MessageThunk
34+
Exception: exn option
35+
Parameters: obj list
36+
AdditionalNamedParameters: ((string * obj * bool) list)
37+
} with
3938

4039
static member StartLogLevel(logLevel: LogLevel) = {
4140
LogLevel = logLevel
@@ -263,30 +262,29 @@ module Types =
263262
/// <param name="message">The message to set for the log.</param>
264263
/// <param name="log">The log to amend.</param>
265264
/// <returns>The amended log.</returns>
266-
let setMessage (message: string) (log: Log) =
267-
{ log with
265+
let setMessage (message: string) (log: Log) = {
266+
log with
268267
Message = Some(fun () -> message)
269-
}
268+
}
270269

271270
/// <summary>
272271
/// Amends a <see cref="T:FsLibLog.Types.Log">Log</see> with a message thunk. Useful for "expensive" string construction scenarios.
273272
/// </summary>
274273
/// <param name="messageThunk">The function that generates a message to add to a Log.</param>
275274
/// <param name="log">The log to amend.</param>
276275
/// <returns>The amended log.</returns>
277-
let setMessageThunk (messageThunk: unit -> string) (log: Log) =
278-
{ log with Message = Some messageThunk }
276+
let setMessageThunk (messageThunk: unit -> string) (log: Log) = { log with Message = Some messageThunk }
279277

280278
/// <summary>
281279
/// Amends a <see cref="T:FsLibLog.Types.Log">Log</see> with a parameter.
282280
/// </summary>
283281
/// <param name="param">The value to add to the log</param>
284282
/// <param name="log">The log to amend.</param>
285283
/// <returns>The amended log.</returns>
286-
let addParameter (param: 'a) (log: Log) =
287-
{ log with
284+
let addParameter (param: 'a) (log: Log) = {
285+
log with
288286
Parameters = List.append log.Parameters [ (box param) ]
289-
}
287+
}
290288

291289
/// <summary>
292290
/// Amends a <see cref="T:FsLibLog.Types.Log">Log</see> with a list of parameters.
@@ -299,10 +297,11 @@ module Types =
299297
``params``
300298
|> List.map box
301299

302-
{ log with
303-
Parameters =
304-
log.Parameters
305-
@ ``params``
300+
{
301+
log with
302+
Parameters =
303+
log.Parameters
304+
@ ``params``
306305
}
307306

308307

@@ -315,10 +314,10 @@ module Types =
315314
/// <param name="value">The value of the parameter to add to the log.</param>
316315
/// <param name="log">The log to amend.</param>
317316
/// <returns>The amended log.</returns>
318-
let addContext (key: string) (value: obj) (log: Log) =
319-
{ log with
317+
let addContext (key: string) (value: obj) (log: Log) = {
318+
log with
320319
AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), false ]
321-
}
320+
}
322321

323322

324323
/// <summary>
@@ -332,10 +331,10 @@ module Types =
332331
/// <param name="value">The value of the parameter to add to the log.</param>
333332
/// <param name="log">The log to amend.</param>
334333
/// <returns>The amended log.</returns>
335-
let addContextDestructured (key: string) (value: obj) (log: Log) =
336-
{ log with
334+
let addContextDestructured (key: string) (value: obj) (log: Log) = {
335+
log with
337336
AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), true ]
338-
}
337+
}
339338

340339

341340
/// <summary>
@@ -344,10 +343,10 @@ module Types =
344343
/// <param name="exception">The exception to add to the log.</param>
345344
/// <param name="log">The log to amend.</param>
346345
/// <returns>The amended log.</returns>
347-
let addException (``exception``: exn) (log: Log) =
348-
{ log with
346+
let addException (``exception``: exn) (log: Log) = {
347+
log with
349348
Exception = Option.ofObj ``exception``
350-
}
349+
}
351350

352351
/// <summary>
353352
/// Amends a <see cref="T:FsLibLog.Types.Log">Log</see> with an <see cref="T:System.Exception">exn</see>. Handles nulls.
@@ -589,13 +588,12 @@ module Providers =
589588
fun name -> func.Invoke("SourceContext", name, false)
590589

591590
[<NoEquality; NoComparison>]
592-
type SerilogGateway =
593-
{
594-
Write: obj -> obj -> string -> obj[] -> unit
595-
WriteException: obj -> obj -> exn -> string -> obj[] -> unit
596-
IsEnabled: obj -> obj -> bool
597-
TranslateLevel: LogLevel -> obj
598-
}
591+
type SerilogGateway = {
592+
Write: obj -> obj -> string -> obj[] -> unit
593+
WriteException: obj -> obj -> exn -> string -> obj[] -> unit
594+
IsEnabled: obj -> obj -> bool
595+
TranslateLevel: LogLevel -> obj
596+
} with
599597

600598
static member Create() =
601599
let logEventLevelType = Type.GetType("Serilog.Events.LogEventLevel, Serilog")
@@ -767,10 +765,9 @@ module Providers =
767765
type MessageArgs = obj array
768766

769767
[<NoEquality; NoComparison>]
770-
type LoggerFactoryGateway =
771-
{
772-
CreateLogger: ILoggerFactory -> LoggerName -> ILogger
773-
}
768+
type LoggerFactoryGateway = {
769+
CreateLogger: ILoggerFactory -> LoggerName -> ILogger
770+
} with
774771

775772
static member Create() =
776773
let createLogger =
@@ -791,14 +788,13 @@ module Providers =
791788

792789
{ CreateLogger = createLogger }
793790

794-
type LoggerGateway =
795-
{
796-
Write: ILogger -> MicrosoftLogLevel -> MessageFormat -> MessageArgs -> unit
797-
WriteError: ILogger -> MicrosoftLogLevel -> exn -> MessageFormat -> MessageArgs -> unit
798-
IsEnabled: ILogger -> MicrosoftLogLevel -> bool
799-
TranslateLevel: LogLevel -> MicrosoftLogLevel
800-
BeginScope: ILogger -> obj -> IDisposable
801-
}
791+
type LoggerGateway = {
792+
Write: ILogger -> MicrosoftLogLevel -> MessageFormat -> MessageArgs -> unit
793+
WriteError: ILogger -> MicrosoftLogLevel -> exn -> MessageFormat -> MessageArgs -> unit
794+
IsEnabled: ILogger -> MicrosoftLogLevel -> bool
795+
TranslateLevel: LogLevel -> MicrosoftLogLevel
796+
BeginScope: ILogger -> obj -> IDisposable
797+
} with
802798

803799
static member Create() =
804800
let loggerExtensions =

0 commit comments

Comments
 (0)