Wire and inject NLog into .NET Core console app

前端 未结 3 1199
北恋
北恋 2021-01-11 09:13

I created a consumer/job that I will have running as a process on Linux written in C#.

The process will:

  1. Read a message from RabbitMQ
  2. Make chang
3条回答
  •  走了就别回头了
    2021-01-11 10:13

    My solution is to use an adapter pattern that uses Console.Writeline, until a more sane version of NLog becomes available.

    using System;
    public static class Log
    {
        public static void Write(string message)
        {
            Console.WriteLine($"{DateTime.Now}: {message}");
        }
    }
    

提交回复
热议问题