Code Monkey home page Code Monkey logo

Comments (5)

 avatar commented on May 26, 2024

Good idea, let me see what I can do.

How would you want the custom text to show up? Would a prefix [MyCustomText] be fine?

from nlog.targets.syslog.

troy avatar troy commented on May 26, 2024

Thanks @graffen and @tsbrooks. I'd encourage using Layouts for this, for a couple reasons:

  • it's the NLog standard that's documented in the core project and users are likely to be familiar with
  • it has renderer macros, not just static strings
  • it supports more message formats (though in the simplest use, would completely obsolete customprefix)
  • it's fairly easy to implement: initialize a Layout object (or more than one if you want more granular layouts for portions of the output), then call its Render method and pass in the LogEventInfo object you have. It returns a string.

from nlog.targets.syslog.

troy avatar troy commented on May 26, 2024

BTW, if you want a hand testing and defaulting to a standard, protocol-compliant remote syslog layout, let me know - happy to help. I'd also document it here.

from nlog.targets.syslog.

 avatar commented on May 26, 2024

@troy Thanks, I wasn't aware of that feature. As I see it, this voids this issue (#2) completely, since the Layout can simply be configured to contain whatever identifier string you would like.

I'll probably remove the customprefix again and simply add a pointer to the documentation.

from nlog.targets.syslog.

troy avatar troy commented on May 26, 2024

@graffen: There's a couple code changes that need to happen for Layouts to work. I haven't implemented it, so I may be missing elements, but it looks like you'll need:

  • to inherit from the abstract class TargetWithLayout
  • getters and setters for at least one Layout object like this, and probably overwriting the default value
  • evaluating the layout with the log event like this

from nlog.targets.syslog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.