messagetemplates / messagetemplates-csharp

A C# implementation of Message Templates

Home Page:http://messagetemplates.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Release 1.0 to nuget

adamchester opened this issue · comments

It's been a while...

is there anything outstanding to make this happen?

#20 would be a pretty big breaking change if we decided to do it post-1.0.

Otherwise, only #21 comes to mind.

What I had in mind:

  1. Go over the public API and quickly verify it all makes sense.
  2. Make sure we understand what's about to happen for build and deployment. For example, right now it's always adding a revision.
  3. #20 and #21 and #22 ?

It's been a while...

Indeed :)

Is this library abandoned, @nblumhardt?

Hi @Leon99 👋 ; I don't think this library ended up with a lot of adoption. It might make sense to archive. I'll do that tomorrow, if no one jumps in in the meantime

Fare enough. Would you suggest an alternative?

Depends on your needs, @Leon99 - the MessageTemplateParser in Serilog is useful for simple ad-hoc use cases. For longer-term projects, forking and adapting one of the existing parsers (from MEL, Serilog, NLog, etc.) would be my bet.

Also open to reviving this project, but I think quite a lot of work will be required to get it to where we'd like.

Let's say I have a simple ad-hoc use case that I achieve with MessageTemplate.Format(message, args). What would be the Serilog way? Something like https://stackoverflow.com/a/35855499/8342076?

Definitely an option 👍

Another is to create a logger with something like var logger = new LoggerConfiguration().CreateLogger(), and then use BindMessageTemplate:

if (logger.BindMessageTemplate("Hello, {Name}!", new[] { "World" }, out var template, out var properties)
{
    var propsByName = properties.ToDictionary(p => p.Name, p => p.Value);
    Console.WriteLine(template.Render(propsByName, null));
    // -> "Hello, World!"
}