mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-20 19:49:18 +00:00
logger: Add logs logging function
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
parent
f560aa7523
commit
c5d4e30e24
@ -11,6 +11,7 @@ class Logger {
|
|||||||
success: NodeJS.ReadWriteStream;
|
success: NodeJS.ReadWriteStream;
|
||||||
warn: NodeJS.ReadWriteStream;
|
warn: NodeJS.ReadWriteStream;
|
||||||
error: NodeJS.ReadWriteStream;
|
error: NodeJS.ReadWriteStream;
|
||||||
|
logs: NodeJS.ReadWriteStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
public formatMessage: (name: string, message: string) => string;
|
public formatMessage: (name: string, message: string) => string;
|
||||||
@ -23,6 +24,7 @@ class Logger {
|
|||||||
logger.addPrefix('success', chalk.green('[Success]'));
|
logger.addPrefix('success', chalk.green('[Success]'));
|
||||||
logger.addPrefix('warn', chalk.yellow('[Warn]'));
|
logger.addPrefix('warn', chalk.yellow('[Warn]'));
|
||||||
logger.addPrefix('error', chalk.red('[Error]'));
|
logger.addPrefix('error', chalk.red('[Error]'));
|
||||||
|
logger.addPrefix('logs', chalk.green('[Logs]'));
|
||||||
|
|
||||||
this.streams = {
|
this.streams = {
|
||||||
build: logger.createLogStream('build'),
|
build: logger.createLogStream('build'),
|
||||||
@ -31,6 +33,7 @@ class Logger {
|
|||||||
success: logger.createLogStream('success'),
|
success: logger.createLogStream('success'),
|
||||||
warn: logger.createLogStream('warn'),
|
warn: logger.createLogStream('warn'),
|
||||||
error: logger.createLogStream('error'),
|
error: logger.createLogStream('error'),
|
||||||
|
logs: logger.createLogStream('logs'),
|
||||||
};
|
};
|
||||||
|
|
||||||
_.forEach(this.streams, function(stream, key) {
|
_.forEach(this.streams, function(stream, key) {
|
||||||
@ -65,6 +68,10 @@ class Logger {
|
|||||||
logBuild(msg: string) {
|
logBuild(msg: string) {
|
||||||
return this.streams.build.write(msg + eol);
|
return this.streams.build.write(msg + eol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logLogs(msg: string) {
|
||||||
|
return this.streams.logs.write(msg + eol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export = Logger;
|
export = Logger;
|
||||||
|
Loading…
Reference in New Issue
Block a user