{"action":"opened","issue":{"url":"https://api.github.com/repos/serilog/serilog/issues/1225","repository_url":"https://api.github.com/repos/serilog/serilog","labels_url":"https://api.github.com/repos/serilog/serilog/issues/1225/labels{/name}","comments_url":"https://api.github.com/repos/serilog/serilog/issues/1225/comments","events_url":"https://api.github.com/repos/serilog/serilog/issues/1225/events","html_url":"https://github.com/serilog/serilog/issues/1225","id":365480269,"node_id":"MDU6SXNzdWUzNjU0ODAyNjk=","number":1225,"title":"String.Interpolation","user":{"login":"aensidhe","id":3948027,"node_id":"MDQ6VXNlcjM5NDgwMjc=","avatar_url":"https://avatars2.githubusercontent.com/u/3948027?v=4","gravatar_id":"","url":"https://api.github.com/users/aensidhe","html_url":"https://github.com/aensidhe","followers_url":"https://api.github.com/users/aensidhe/followers","following_url":"https://api.github.com/users/aensidhe/following{/other_user}","gists_url":"https://api.github.com/users/aensidhe/gists{/gist_id}","starred_url":"https://api.github.com/users/aensidhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aensidhe/subscriptions","organizations_url":"https://api.github.com/users/aensidhe/orgs","repos_url":"https://api.github.com/users/aensidhe/repos","events_url":"https://api.github.com/users/aensidhe/events{/privacy}","received_events_url":"https://api.github.com/users/aensidhe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-01T14:10:40Z","updated_at":"2018-10-01T14:10:40Z","closed_at":null,"author_association":"NONE","body":"**Does this issue relate to a new *feature* or an existing *bug*?**\r\n- [ ] Bug\r\n- [x] New Feature\r\n\r\nI read [this post](https://nblumhardt.com/2015/01/c-6-string-interpolation-and-serilog/) and [this issue](https://github.com/serilog/serilog/issues/639)\r\n\r\nBlog post states two points against string interpolation:\r\n1. A good variable name is not necessarily a good property name\r\n2. Holes don’t always have obvious names\r\n\r\nLet's look onto this code:\r\n```csharp\r\nusing System;\r\n\r\nnamespace String.Interpolation\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            var a = 123;\r\n            var b = true;\r\n            var c = \"adf\";\r\n            F($\"{a:Int}, {b:Bool}, {c:Str}\");\r\n            F($\"{a}, {b}, {c}\");\r\n        }\r\n\r\n        private static void F(FormattableString s)\r\n        {\r\n            Console.WriteLine();\r\n            Console.WriteLine(s.Format);\r\n            foreach (var o in s.GetArguments())\r\n            {\r\n                Console.WriteLine(o);\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nIt's produce output:\r\n\r\n```\r\n{0:Int}, {1:Bool}, {2:Str}\r\n123\r\nTrue\r\nadf\r\n\r\n{0}, {1}, {2}\r\n123\r\nTrue\r\nadf\r\n```\r\n\r\nWe can parse and pass `s.Format` and arguments from `s.GetArguments()` to usual `ILogger` methods and have current behaviour with mitigated point 1 about names.\r\n\r\nPoint number 2 (about holes) is not mitigated, but can be via analyzer for compiler.\r\n\r\nI think that will be great addition to great library."}}
{"actor":{"display_login":"aensidhe"}}