Logger setting for custom logger

2 messages Options
Embed this post
Permalink
Jonathan Parker

Logger setting for custom logger

Reply Threaded More More options
Print post
Permalink
Hi,

As you know I'm implementing a custom logger.
The problem I'm facing now is that the type of the logger (I'm not inheriting from Logger I'm using composition)
is still NLog.Logger not my Logger class. This means that the NLog.LoggerImpl.Write method gets the wrong value for firstUserFrame (see bellow)
which means that the Logger field is being logged as my Logger class rather than the class that called my class.

Are there any options without modifying the core code? It doesn't look like i can create a custom LoggerImpl.

Your help is much appreciated.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Jaroslaw Kowalski

Re: Logger setting for custom logger

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Yes. It's possible. See examples/LoggerWrapper for sample implementation.
 
The key is passing the wrapper type to Logger.Log method. This will be used by NLog to determine the first user frame, by skipping all NLog methods and all other methods until methods from the wrapper type have been reached. The next stack frame becomes the user stack frame.
 
Jarek
----- Original Message -----
Sent: Tuesday, January 13, 2009 4:38 PM
Subject: [Nlog-list] Logger setting for custom logger

Hi,

As you know I'm implementing a custom logger.
The problem I'm facing now is that the type of the logger (I'm not inheriting from Logger I'm using composition)
is still NLog.Logger not my Logger class. This means that the NLog.LoggerImpl.Write method gets the wrong value for firstUserFrame (see bellow)
which means that the Logger field is being logged as my Logger class rather than the class that called my class.

Are there any options without modifying the core code? It doesn't look like i can create a custom LoggerImpl.

Your help is much appreciated.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword


_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list