private static IDisposable BeginValueTupleScope <T>(ValueTuple <string, T> item) { return(GelfLogScope.Push(new[] { new KeyValuePair <string, object>(item.Item1, item.Item2) })); }
public IDisposable BeginScope <TState>(TState state) { switch (state) { case ValueTuple <string, string> s: return(BeginValueTupleScope(s)); case ValueTuple <string, sbyte> sb: return(BeginValueTupleScope(sb)); case ValueTuple <string, byte> b: return(BeginValueTupleScope(b)); case ValueTuple <string, short> sh: return(BeginValueTupleScope(sh)); case ValueTuple <string, ushort> us: return(BeginValueTupleScope(us)); case ValueTuple <string, int> i: return(BeginValueTupleScope(i)); case ValueTuple <string, uint> ui: return(BeginValueTupleScope(ui)); case ValueTuple <string, long> l: return(BeginValueTupleScope(l)); case ValueTuple <string, ulong> ul: return(BeginValueTupleScope(ul)); case ValueTuple <string, float> f: return(BeginValueTupleScope(f)); case ValueTuple <string, double> d: return(BeginValueTupleScope(d)); case ValueTuple <string, decimal> dc: return(BeginValueTupleScope(dc)); case ValueTuple <string, object> o: return(BeginValueTupleScope(o)); case IEnumerable <KeyValuePair <string, object> > additionalFields: return(GelfLogScope.Push(additionalFields)); default: return(new NoopDisposable()); } }
public IDisposable BeginScope <TState>(TState state) { switch (state) { case ValueTuple <string, string> additionalField: return(GelfLogScope.Push(new[] { new KeyValuePair <string, object>(additionalField.Item1, additionalField.Item2) })); case IEnumerable <KeyValuePair <string, object> > additionalFields: return(GelfLogScope.Push(additionalFields)); default: return(new NoopDisposable()); } }
public IDisposable BeginScope <TState>(TState state) { return(state switch { IEnumerable <KeyValuePair <string, object> > fields => GelfLogScope.Push(fields), ValueTuple <string, string> field => BeginValueTupleScope(field), ValueTuple <string, sbyte> field => BeginValueTupleScope(field), ValueTuple <string, byte> field => BeginValueTupleScope(field), ValueTuple <string, short> field => BeginValueTupleScope(field), ValueTuple <string, ushort> field => BeginValueTupleScope(field), ValueTuple <string, int> field => BeginValueTupleScope(field), ValueTuple <string, uint> field => BeginValueTupleScope(field), ValueTuple <string, long> field => BeginValueTupleScope(field), ValueTuple <string, ulong> field => BeginValueTupleScope(field), ValueTuple <string, float> field => BeginValueTupleScope(field), ValueTuple <string, double> field => BeginValueTupleScope(field), ValueTuple <string, decimal> field => BeginValueTupleScope(field), ValueTuple <string, object> field => BeginValueTupleScope(field), _ => new NoopDisposable() });