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:
Tiara Rodney 2026-03-13 22:42:52 +01:00
parent 9fed1ffe6b
commit 0b87f5516a
No known key found for this signature in database
GPG key ID: 5CD8EC1D46106723
2 changed files with 15 additions and 1 deletions

View file

@ -174,6 +174,20 @@ export class Formatter {
* formatters, for example if you want all logging times to be shown in GMT,
* 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 {
//TODO: record.created

View file

@ -22,7 +22,7 @@ var loggerClass = Logger;
* Placeholder instance
*/
class Placeholder {
protected loggers: Logger[] = [];
public loggers: Logger[] = [];
/**
* initialize with the specified logger being a child of this placeholder.