You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Ron Grabowski (JIRA)" <ji...@apache.org> on 2009/05/28 06:06:45 UTC
[jira] Created: (LOG4NET-216) Write a simple option parser for
pattern converters
Write a simple option parser for pattern converters
---------------------------------------------------
Key: LOG4NET-216
URL: https://issues.apache.org/jira/browse/LOG4NET-216
Project: Log4net
Issue Type: New Feature
Components: Other
Affects Versions: 1.2.11
Reporter: Ron Grabowski
Priority: Minor
Fix For: 1.2.11
There isn't a standard way of passing in more than just a single value into pattern converters:
%logger{2}
Create a simple parser that can split out the Option string:
public class RepeatConverter : PatternConverter
{
protected override void Convert(TextWriter writer, object state)
{
SimpleOptionParser optionParser = new SimpleOptionParser(Option);
char character = optionParser.GetChar("Character");
int repeat = optionParser.GetInt("Repeat", 1); // defaults to 1
writer.Write(new String(character, repeat));
}
}
Where the pattern might look something like this in the config file:
%repeat{Character:a,Repeat,10}
that would be translated into:
aaaaaaaaaa
Are there more established ways of encoding multiple values in a string?
%repeat{character:a;repeat:10}
%repeat{character=a:char,repeat=10:int}
???
Maybe this will allow the next next version of log4net to support nested patterns...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.