Skip to content

Conversation

stochmal
Copy link
Contributor

@stochmal stochmal commented Apr 20, 2021

@nblumhardt
Copy link
Member

Thanks Tomasz!

Initial thoughts -

  • We'd need to add some tests for this
  • Should we consider StringSplitOptions.RemoveEmptyEntries or similar?
  • Is ; the best separator, vs. e.g. , or |, etc.?
    • ';' can be hard to grapple with in shells (e.g. where it might be a command separator)
    • using , might lead us towards supporting CSV as the value format, down the track, which has reasonably well-known escaping mechanisms
    • is there any precedent in related projects we should consider?
  • The codebase doesn't use explicit private or internal
  • Should we be supporting any T[] type here by recursively converting the values?
  • Or, should this be one of the ExtendedTypeConversions?

@stochmal
Copy link
Contributor Author

I need this fix for company project I am working on. Lets see what I can change.

@nblumhardt
Copy link
Member

Any thoughts on:

  • Should we be supporting any T[] type here by recursively converting the values?

Would seem to make this a more well-rounded addition.

@nblumhardt
Copy link
Member

Hi @stochmal - still interested in pushing this forward?

@nblumhardt nblumhardt changed the title fixed exception Add support for collections/string[] to key-value settings Jun 8, 2021
@stochmal
Copy link
Contributor Author

yes need this fix as it's broken in .NET Framework (works fine in .NET Core)

@tomasz-stochmal
Copy link
Contributor

Any thoughts on:

  • Should we be supporting any T[] type here by recursively converting the values?

Would seem to make this a more well-rounded addition.

tags are set in config file so it's always string to string[] conversion so don't see any use case for other array type

@stochmal
Copy link
Contributor Author

Any thoughts on:

  • Should we be supporting any T[] type here by recursively converting the values?

Would seem to make this a more well-rounded addition.

tags are set in config file so it's always string to string[] conversion so don't see any use case for other array type

this entry in App.config is crashing Serilog

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="serilog:write-to:DatadogLogs.tags" value="name:ZA2-FUNDSTI1,client:IRESS,owner:Trading,key:trading-production-za,application:FundsTradingInterface" />
  </appSettings>
</configuration>

@nblumhardt
Copy link
Member

tags are set in config file so it's always string to string[] conversion so don't see any use case for other array type

Configuration method args can be any type; if a sink takes int batchSize then value="2" will be converted today. If a method takes int[] then a value like "2,3,4" should probably work, if we're aiming for consistency.

@nblumhardt
Copy link
Member

Awesome, thanks @stochmal ! Looks good to me, too - should have this in today 👍

@nblumhardt nblumhardt merged commit e10d338 into serilog:dev Aug 19, 2021
@stochmal
Copy link
Contributor Author

Nice, Thanks for your help. When will there be official release that contains that fix?

@stochmal stochmal deleted the issue-1560-conversion-error-from-string-to-string-array branch August 19, 2021 07:58
@nblumhardt
Copy link
Member

I've just opened #1614 to track the next stable release; I'll add more details there as we figure out the schedule 👍

@nblumhardt nblumhardt mentioned this pull request Apr 23, 2022
Twinki14 pushed a commit to Twinki14/CitizenFX.Extensions.Client.Serilog that referenced this pull request Dec 30, 2023
…#1561)

* fixed exception

* added unit test and using comma as seperator

* added empty array return

* removed internal

* added support for int[] support

* support any collection type

* Remove unnecessary newline

Co-authored-by: Tomasz Stochmal <tomasz.stochmal@iress.com>
Co-authored-by: Nicholas Blumhardt <nblumhardt@nblumhardt.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants