เพิ่ม File Logging ใน .Net Core (F#)

  1. ติดตั้งแพ็กเกจ Serilog.Extensions.Logging.File

<PackageReference Include=”Serilog.Extensions.Logging.File” Version=”1.0.1" />

2. เพิ่ม ILoggerFactory.AddFile() ในฟังก์ชั่น Configure() ในไฟล์ Startup.fs

member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment, loggerFactory: ILoggerFactory) =
  let root = env.ContentRootPath
let logFile = sprintf "%s/Logs/{Date}.txt" root
loggerFactory.AddConsole() |> ignore
loggerFactory.AddDebug() |> ignore
loggerFactory.AddFile(logFile) |> ignore
...
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.