Skip to content

Consider supporting a streamlined WriteTo syntax #49

Open
@nblumhardt

Description

@nblumhardt

"WriteTo", and other configuration elements that accept arguments, use a syntax like:

  "WriteTo": [
       {"Name": "File", "Args": {"path": "%APPDATA%\\log.txt" }}
   ]

"WriteTo" accepts an array so that it's easy to extrapolate from configuring one instance of a sink, to multiple instances:

  "WriteTo": [
       {"Name": "File", "Args": {"path": "%APPDATA%\\log.txt" }},
       {"Name": "File", "Args": {"path": "%APPDATA%\\another-log.txt" }}
   ]

The syntax is a bit unwieldy. If only one instance of each sink is used, "WriteTo" could accept an object, and there would be no (invalid) duplication of property names:

  "WriteTo": {
       "File": {"path": "%APPDATA%\\log.txt" }
   }

Behind the scenes, I think we could implement this today alongside the current syntax, by considering "WriteTo" elements with numeric names to be the verbose array syntax, and otherwise assume the compact syntax is being used. (I say this without having spiked it out, so there could be obstacles in the way...)

The downside of the change would be more complexity (attempting to accept a new syntax while not breaking existing configurations), and confusion while documentation, examples, etc. move across.

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions