Skip to content

Instantly share code, notes, and snippets.

@vchircu
Last active July 10, 2016 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vchircu/13105165d37d7090e6b4bdb849328054 to your computer and use it in GitHub Desktop.
Save vchircu/13105165d37d7090e6b4bdb849328054 to your computer and use it in GitHub Desktop.
public class LoggerBehavior : IBehavior<IncomingContext>
{
private static readonly ILog logger = LogManager.GetLogger(typeof(LoggerBehavior));
public void Invoke(IncomingContext context, Action next)
{
try
{
logger.Info("Entered the behavior.");
next();
logger.Info("Exited the behavior.");
}
catch (Exception ex)
{
logger.Error("Finished processing with errors.", ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment