feat(issue-77): handle multiple target branches (#78)

fix: https://github.com/kiegroup/git-backporting/issues/77

This enhancement allow users to backport the same change to multiple
branches with one single tool invocation
This commit is contained in:
Andrea Lamparelli 2023-08-03 21:57:11 +02:00 committed by GitHub
parent c19a56a9ad
commit 5fc72e127b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 1774 additions and 234 deletions

View file

@ -5,32 +5,44 @@ export default class ConsoleLoggerService implements LoggerService {
private readonly logger: Logger;
private readonly verbose: boolean;
private context?: string;
constructor(verbose = true) {
this.logger = new Logger();
this.verbose = verbose;
}
setContext(newContext: string) {
this.context = newContext;
}
clearContext() {
this.context = undefined;
}
trace(message: string): void {
this.logger.log("TRACE", message);
this.logger.log("TRACE", this.fromContext(message));
}
debug(message: string): void {
if (this.verbose) {
this.logger.log("DEBUG", message);
this.logger.log("DEBUG", this.fromContext(message));
}
}
info(message: string): void {
this.logger.log("INFO", message);
this.logger.log("INFO", this.fromContext(message));
}
warn(message: string): void {
this.logger.log("WARN", message);
this.logger.log("WARN", this.fromContext(message));
}
error(message: string): void {
this.logger.log("ERROR", message);
this.logger.log("ERROR", this.fromContext(message));
}
private fromContext(msg: string): string {
return this.context ? `[${this.context}] ${msg}` : msg;
}
}

View file

@ -3,6 +3,10 @@
*/
export default interface LoggerService {
setContext(newContext: string): void;
clearContext(): void;
trace(message: string): void;
debug(message: string): void;