|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectautohit.common.AutohitLogDrain
An abstract logging formatter for Autohit Tools. It will try to log anything that has a String in the atom. You can route Atom.senderIDs to different output streams.
The subclasses need to implement a setWriter() and initchain().
A pretty flag tells the formatter to keep the lines under 80 characters, applying wrapping where possible. TRUE means pretty. The default is FALSE. It will use the line.separator property to put a return on the wrapped lines.
NOT STAMPED
0123456789...............{79}
IINNNN:tttttttttt......t[EOL]
:tttttttttt......t[EOL]
[ 7 ][ 69 ]
STAMPED (with default formatter)
We will reserve 4 extra spacers that an overloading formatter can use.
012345678901234567890123456789...............{79}
IINNNN[DD:HHMMSS]tttttttttt.................t[EOL]
]tttttttttt.................t[EOL]
[ 6 ][9+3extra ][ 54 ]
[18] + [61] = 79
Cs0000:223600: XMLCompiler: Software Detected Fault: SAXException mad
e it out of the builder.
EPG - Rewrite - 27Apr03
Field Summary | |
protected java.io.Writer |
myWriter
|
Constructor Summary | |
AutohitLogDrain()
Default constructor You must init() the drain before it is valid. |
Method Summary | |
abstract void |
discardWriter(java.lang.String id)
The subclass uses this to discard the Writer. |
protected java.lang.String |
form(java.lang.String s)
Form this string into an entry. |
void |
init(java.io.OutputStream os)
Call this to initialize. |
void |
init(java.io.OutputStream os,
int linesize)
Call this to initialize. |
abstract void |
initchain()
The subclass should implement this to do any initialization. |
java.lang.String |
numericFormatter(int n)
This formats the the numeric into a four digit string. |
Receipt |
post(Atom a)
Post an item Don't care about receipts |
void |
setLineLimit(int limit)
Set the max number characters printed per line |
void |
setPrettyFlag(boolean b)
This sets the pretty flag. |
void |
setTimestampFlag(boolean b)
This sets the timestamp flag. |
abstract void |
setWriter(java.lang.String id)
The subclass uses this to set the Writer. |
java.lang.String |
timestampFormatter(long stamp)
This formats the timestamp for stamped entries. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.Writer myWriter
Constructor Detail |
public AutohitLogDrain()
Method Detail |
public Receipt post(Atom a) throws ChannelException
post
in interface Drain
a
- An atom containing the posted data
ChannelException
public java.lang.String numericFormatter(int n)
n
- numeric value
public java.lang.String timestampFormatter(long stamp)
stamp
- timestamp in milliseconds. This formatter assumes it is the unmodified system time.
protected java.lang.String form(java.lang.String s)
s
- string
public void setPrettyFlag(boolean b)
b
- public void setTimestampFlag(boolean b)
b
- public void setLineLimit(int limit)
limit
- the number of characters printed in a linepublic abstract void setWriter(java.lang.String id) throws java.lang.Exception
id
-
java.lang.Exception
public abstract void discardWriter(java.lang.String id) throws java.lang.Exception
id
-
java.lang.Exception
public abstract void initchain()
public void init(java.io.OutputStream os) throws java.lang.Exception
java.lang.Exception
public void init(java.io.OutputStream os, int linesize) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |