basic05
ZLogger๋?
// program.cs์์ logging ์ค์ using Zlogger; var builder = WebApplication.CreateBuilder(args); // ๊ธฐ๋ณธ ์ ๊ณต์๋ฅผ ์ฌ์ ์ํด์ค๋ค. builder.logging.ClearProviders(); // optional(MS.E.Logging): default๊ฐ์ Info์ด๋ฉฐ option์ ๋ฐ๊ฟ ์ต์ ๋ก๊ทธ๋ ๋ฒจ์ ์ง์ ํด ์ค ์ ์๋ค. builder.logging.SetMinimumLevel(LogLevel.Debug); // ์ฝ์์ ์ถ๋ ฅํ๋ค. builder.logging.AddZLoggerConsole(); // ์ง์ ๋ ํ์ผ์ ์ถ๋ ฅํ๋ค. builder.logging.AddZLoggerFile("fileName.log"); // ๋ ์ง-์๊ฐ ๋๋ ํ์ผ ํฌ๊ธฐ์ ๋ฐ๋ผ ์ถ๋ ฅ ํ์ผ ๊ฒฝ๋ก๋ฅผ ๋ณ๊ฒฝํ๋ค. builder.logging.AddZLoggerRollingFile((dt, x) => $"logs/{dt.ToLocalTime():yyyy-MM-dd}_{x:000}.log", x => x.ToLocalTime().Date, 1024); // ๊ตฌ์กฐํ๋ ๋ก๊น ์ง์ builder.logging.AddZLoggerConsole(options => { options.EnableStructuredLogging = true; });
ZLogger ์ฌ์ฉ ํ
์คํธ

Last updated