[ https://issues.apache.org/jira/browse/LOG4NET-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13796718#comment-13796718 ]
Dmitry Naumov commented on LOG4NET-290: --------------------------------------- I don't understand why you added cost of building lambda to logging. There were no need to write condition {code} if (log.IsDebugEnabled) {code} it's been in log4net for ages, since 1.2.8 if I remember correctly. Do not do string.Format, log4net does it for you if and only if logger is enabled: {code} public virtual void DebugFormat(string format, params object[] args) { if (this.IsDebugEnabled) { this.Logger.Log(ThisDeclaringType, this.m_levelDebug, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), null); } } {code} Now with these extensions more people will be confused about "checking for enabled" and more code will be poluted with these dummy checks. > Add Lambda-based ILog-Extensions (embedded log.IsEnabled) > --------------------------------------------------------- > > Key: LOG4NET-290 > URL: https://issues.apache.org/jira/browse/LOG4NET-290 > Project: Log4net > Issue Type: New Feature > Components: Core > Affects Versions: 1.2.10 > Reporter: Lars Corneliussen > Assignee: Dominik Psenner > Fix For: 1.2.12 > > Attachments: LOG4NET-290-doc.patch, LOG4NET-290.patch > > > This statement: > if (log.IsDebugEnabled) log.DebugFormat("x: {0}", 123) > Could be nicely shortened to: > log.Debug( m=>m("value= {0}", obj.Value) ); > I'm already apache committer (NPanday Incubator Project) and would be happy > to help with this interface. The simplest thing would be to offer it as > static Extension-Methods to ILog. -- This message was sent by Atlassian JIRA (v6.1#6144)