forked from mystiq/hydrogen-web
reduce size of ILogItem interface further
This commit is contained in:
parent
4030a4918d
commit
b5e9eb26ba
3 changed files with 9 additions and 10 deletions
|
@ -139,7 +139,7 @@ export abstract class BaseLogger implements ILogger {
|
|||
this._openItems.clear();
|
||||
}
|
||||
|
||||
abstract _persistItem(item: ILogItem, filter?: LogFilter, forced?: boolean): void;
|
||||
abstract _persistItem(item: LogItem, filter?: LogFilter, forced?: boolean): void;
|
||||
|
||||
abstract export(): Promise<ILogExport | undefined>;
|
||||
|
||||
|
|
|
@ -14,10 +14,11 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
import {BaseLogger} from "./BaseLogger";
|
||||
import {LogItem} from "./LogItem";
|
||||
import type {ILogItem, LogItemValues, ILogExport} from "./types";
|
||||
|
||||
export class ConsoleLogger extends BaseLogger {
|
||||
_persistItem(item: ILogItem): void {
|
||||
_persistItem(item: LogItem): void {
|
||||
printToConsole(item);
|
||||
}
|
||||
|
||||
|
@ -37,7 +38,7 @@ function filterValues(values: LogItemValues): LogItemValues | null {
|
|||
}, null);
|
||||
}
|
||||
|
||||
function printToConsole(item: ILogItem): void {
|
||||
function printToConsole(item: LogItem): void {
|
||||
const label = `${itemCaption(item)} (${item.duration}ms)`;
|
||||
const filteredValues = filterValues(item.values);
|
||||
const shouldGroup = item.children || filteredValues;
|
||||
|
|
|
@ -34,15 +34,13 @@ export interface ISerializedItem {
|
|||
};
|
||||
|
||||
export interface ILogItem {
|
||||
logger: any;
|
||||
level: typeof LogLevel;
|
||||
duration?: number;
|
||||
end?: number;
|
||||
start?: number;
|
||||
logLevel: LogLevel;
|
||||
children?: Array<ILogItem>;
|
||||
values: LogItemValues;
|
||||
error?: Error;
|
||||
readonly logger: ILogger;
|
||||
readonly level: typeof LogLevel;
|
||||
readonly end?: number;
|
||||
readonly start?: number;
|
||||
readonly values: LogItemValues;
|
||||
wrap<T>(labelOrValues: LabelOrValues, callback: LogCallback<T>, logLevel?: LogLevel, filterCreator?: FilterCreator): T;
|
||||
log(labelOrValues: LabelOrValues, logLevel?: LogLevel): void;
|
||||
set(key: string | object, value: unknown): void;
|
||||
|
|
Loading…
Reference in a new issue