Skip to content

chore: merge release in master #4612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions lib/common/definitions/logger.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,36 @@ declare global {
trace(formatStr?: any, ...args: any[]): void;
printMarkdown(...args: any[]): void;
prepare(item: any): string;

/**
* DEPRECATED
* Do not use it.
*/
out(formatStr?: any, ...args: any[]): void;

/**
* DEPRECATED
* Do not use it.
*/
write(...args: any[]): void;

/**
* DEPRECATED
* Do not use it.
*/
printInfoMessageOnSameLine(message: string): void;

/**
* DEPRECATED
* Do not use it.
*/
printMsgWithTimeout(message: string, timeout: number): Promise<void>;

/**
* DEPRECATED
* Do not use it.
*/
printOnStderr(formatStr?: any, ...args: any[]): void;
}

interface Log4JSAppenderConfiguration extends Configuration {
Expand Down
40 changes: 31 additions & 9 deletions lib/common/logger/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@ export class Logger implements ILogger {
this.logMessage(args, LoggerLevel.INFO);
}

/**
* DEPRECATED
* Present only for backwards compatibility as some plugins (nativescript-plugin-firebase)
* use $logger.out in their hooks
*/
out(...args: any[]): void {
this.info(args);
}

debug(...args: any[]): void {
const encodedArgs: string[] = this.getPasswordEncodedArguments(args);
this.logMessage(encodedArgs, LoggerLevel.DEBUG);
Expand Down Expand Up @@ -200,6 +191,37 @@ export class Logger implements ILogger {
return argument;
});
}

/*******************************************************************************************
* Metods below are deprecated. Delete them in 6.0.0 release: *
* Present only for backwards compatibility as some plugins (nativescript-plugin-firebase) *
* use these methods in their hooks *
*******************************************************************************************/

out(...args: any[]): void {
this.info(args);
}

write(...args: any[]): void {
this.info(args, { [LoggerConfigData.skipNewLine]: true });
}

printOnStderr(...args: string[]): void {
this.error(args);
}

printInfoMessageOnSameLine(message: string): void {
this.info(message, { [LoggerConfigData.skipNewLine]: true });
}

printMsgWithTimeout(message: string, timeout: number): Promise<void> {
return new Promise<void>((resolve, reject) => {
setTimeout(() => {
this.printInfoMessageOnSameLine(message);
resolve();
}, timeout);
});
}
}

$injector.register("logger", Logger);
6 changes: 6 additions & 0 deletions lib/common/test/unit-tests/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export class CommonLoggerStub implements ILogger {
printMarkdown(message: string): void {
this.output += message;
}

out(formatStr?: any, ...args: any[]): void { }
write(...args: any[]): void { }
printInfoMessageOnSameLine(message: string): void { }
async printMsgWithTimeout(message: string, timeout: number): Promise<void> { }
printOnStderr(formatStr?: any, ...args: any[]): void { }
}

export class ErrorsStub implements IErrors {
Expand Down
2 changes: 1 addition & 1 deletion lib/declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ interface IOptions extends IRelease, IDeviceIdentifier, IJustLaunch, IAvd, IAvai
analyticsLogFile: string;
performance: Object;
cleanupLogFile: string;
workflow: boolean;
workflow: any;
setupOptions(projectData: IProjectData): void;
printMessagesForDeprecatedOptions(logger: ILogger): void;
}
Expand Down
6 changes: 6 additions & 0 deletions test/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export class LoggerStub implements ILogger {
}

printMarkdown(message: string): void { }

out(formatStr?: any, ...args: any[]): void { }
write(...args: any[]): void { }
printInfoMessageOnSameLine(message: string): void { }
async printMsgWithTimeout(message: string, timeout: number): Promise<void> { }
printOnStderr(formatStr?: any, ...args: any[]): void { }
}

export class FileSystemStub implements IFileSystem {
Expand Down