38 |
|
//---PUBLIC METHODS--- |
39 |
|
|
40 |
|
/** |
41 |
< |
* The write() method takes a message, formats it using the |
42 |
< |
* formatLogLine() method, and then outputs it to the screen |
43 |
< |
* using System.out.println(). The source is usually the |
44 |
< |
* calling object, referenced by `this'. The method has been |
45 |
< |
* made synchronized to avoid it being called by two different |
46 |
< |
* objects and the output ending up merged on the screen. |
47 |
< |
* |
48 |
< |
* @param source A string representation of the calling object. |
49 |
< |
* @param verbosity the verbosity of this message |
50 |
< |
* @param message The text to be logged. |
51 |
< |
*/ |
41 |
> |
* The write() method takes a line of text, pre-formatted |
42 |
> |
* and outputs it using a method defined by the actual |
43 |
> |
* implementation. The verbosity is given in case the |
44 |
> |
* implementation wishes to utilise it in the layout - |
45 |
> |
* eg. a different colour or font. |
46 |
> |
* |
47 |
> |
* This instance passes the message on to a ScreenLogger |
48 |
> |
* and a FileLogger. |
49 |
> |
* |
50 |
> |
* @param line A line of formatted text to be logged |
51 |
> |
* @param verbosity the verbosity of this message |
52 |
> |
*/ |
53 |
|
public synchronized void write(String line, int verbosity) { |
54 |
|
_screenlog.write(line, verbosity); |
55 |
|
_filelog.write(line, verbosity); |
72 |
|
} |
73 |
|
|
74 |
|
//---PRIVATE METHODS--- |
75 |
< |
|
75 |
> |
|
76 |
> |
/** |
77 |
> |
* This method is provided if this class wishes to log |
78 |
> |
* a message itself. |
79 |
> |
* |
80 |
> |
* @param source A String representation of the source |
81 |
> |
* @param verbosity the verbosity of this message |
82 |
> |
* @param message The message to log |
83 |
> |
*/ |
84 |
|
private void write(String source, int verbosity, String message) { |
85 |
|
write(FormatName.formatLogLine(source, verbosity, message), verbosity); |
86 |
|
} |