fix(formatter,manager): add Formatter.format(), fix Placeholder access
Add format() method to Formatter class to delegate to the style's format method. Change Placeholder.loggers to public so Manager can access it for hierarchy fixup.
This commit is contained in:
parent
9fed1ffe6b
commit
0b87f5516a
2 changed files with 15 additions and 1 deletions
|
|
@ -174,6 +174,20 @@ export class Formatter {
|
||||||
* formatters, for example if you want all logging times to be shown in GMT,
|
* formatters, for example if you want all logging times to be shown in GMT,
|
||||||
* set the 'converter' attribute in the Formatter class.
|
* set the 'converter' attribute in the Formatter class.
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* Format the specified record as text.
|
||||||
|
*
|
||||||
|
* The record's attribute dictionary is used as the operand to a string
|
||||||
|
* formatting operation which yields the returned string. Before the
|
||||||
|
* formatting operation, a couple of preparatory steps are carried out.
|
||||||
|
* The message attribute of the record is computed using LogRecord.getMessage().
|
||||||
|
* If the formatting string uses the time, formatTime() is called to format
|
||||||
|
* the event time.
|
||||||
|
*/
|
||||||
|
format(record: LogRecord): string {
|
||||||
|
return this.style.format(record);
|
||||||
|
}
|
||||||
|
|
||||||
formatTime(record: LogRecord, datefmt?: any): string {
|
formatTime(record: LogRecord, datefmt?: any): string {
|
||||||
|
|
||||||
//TODO: record.created
|
//TODO: record.created
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ var loggerClass = Logger;
|
||||||
* Placeholder instance
|
* Placeholder instance
|
||||||
*/
|
*/
|
||||||
class Placeholder {
|
class Placeholder {
|
||||||
protected loggers: Logger[] = [];
|
public loggers: Logger[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize with the specified logger being a child of this placeholder.
|
* initialize with the specified logger being a child of this placeholder.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue