logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Psenner (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-290) Add Lambda-based ILog-Extensions (embedded log.IsEnabled)
Date Thu, 11 Apr 2013 10:51:21 GMT

    [ https://issues.apache.org/jira/browse/LOG4NET-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13628831#comment-13628831
] 

Dominik Psenner commented on LOG4NET-290:
-----------------------------------------

That could still be done with an extension:

public static void FatalExt(this ILog logger, Func<object> callback)
{
  if (!logger.IsFatalEnabled)
    return;
  logger.Fatal(callback());
}

Of course these extensions would be available only for the log4net versions compiled against
.NET 3.5 or .NET 4.0. This is also my biggest reason of concern. Some specific log4net libraries
will contain stuff that others don't have - a terrible API decision.
                
> 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
>             Fix For: 3.5
>
>         Attachments: ILog.cs.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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message