Skip to content

Commit 66daa62

Browse files
Merge pull request #4612 from NativeScript/vladimirov/merge-rel-master
chore: merge release in master
2 parents 7fcece8 + f8a6d0f commit 66daa62

File tree

5 files changed

+74
-10
lines changed

5 files changed

+74
-10
lines changed

lib/common/definitions/logger.d.ts

+30
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,36 @@ declare global {
2525
trace(formatStr?: any, ...args: any[]): void;
2626
printMarkdown(...args: any[]): void;
2727
prepare(item: any): string;
28+
29+
/**
30+
* DEPRECATED
31+
* Do not use it.
32+
*/
33+
out(formatStr?: any, ...args: any[]): void;
34+
35+
/**
36+
* DEPRECATED
37+
* Do not use it.
38+
*/
39+
write(...args: any[]): void;
40+
41+
/**
42+
* DEPRECATED
43+
* Do not use it.
44+
*/
45+
printInfoMessageOnSameLine(message: string): void;
46+
47+
/**
48+
* DEPRECATED
49+
* Do not use it.
50+
*/
51+
printMsgWithTimeout(message: string, timeout: number): Promise<void>;
52+
53+
/**
54+
* DEPRECATED
55+
* Do not use it.
56+
*/
57+
printOnStderr(formatStr?: any, ...args: any[]): void;
2858
}
2959

3060
interface Log4JSAppenderConfiguration extends Configuration {

lib/common/logger/logger.ts

+31-9
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@ export class Logger implements ILogger {
8181
this.logMessage(args, LoggerLevel.INFO);
8282
}
8383

84-
/**
85-
* DEPRECATED
86-
* Present only for backwards compatibility as some plugins (nativescript-plugin-firebase)
87-
* use $logger.out in their hooks
88-
*/
89-
out(...args: any[]): void {
90-
this.info(args);
91-
}
92-
9384
debug(...args: any[]): void {
9485
const encodedArgs: string[] = this.getPasswordEncodedArguments(args);
9586
this.logMessage(encodedArgs, LoggerLevel.DEBUG);
@@ -200,6 +191,37 @@ export class Logger implements ILogger {
200191
return argument;
201192
});
202193
}
194+
195+
/*******************************************************************************************
196+
* Metods below are deprecated. Delete them in 6.0.0 release: *
197+
* Present only for backwards compatibility as some plugins (nativescript-plugin-firebase) *
198+
* use these methods in their hooks *
199+
*******************************************************************************************/
200+
201+
out(...args: any[]): void {
202+
this.info(args);
203+
}
204+
205+
write(...args: any[]): void {
206+
this.info(args, { [LoggerConfigData.skipNewLine]: true });
207+
}
208+
209+
printOnStderr(...args: string[]): void {
210+
this.error(args);
211+
}
212+
213+
printInfoMessageOnSameLine(message: string): void {
214+
this.info(message, { [LoggerConfigData.skipNewLine]: true });
215+
}
216+
217+
printMsgWithTimeout(message: string, timeout: number): Promise<void> {
218+
return new Promise<void>((resolve, reject) => {
219+
setTimeout(() => {
220+
this.printInfoMessageOnSameLine(message);
221+
resolve();
222+
}, timeout);
223+
});
224+
}
203225
}
204226

205227
$injector.register("logger", Logger);

lib/common/test/unit-tests/stubs.ts

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export class CommonLoggerStub implements ILogger {
4545
printMarkdown(message: string): void {
4646
this.output += message;
4747
}
48+
49+
out(formatStr?: any, ...args: any[]): void { }
50+
write(...args: any[]): void { }
51+
printInfoMessageOnSameLine(message: string): void { }
52+
async printMsgWithTimeout(message: string, timeout: number): Promise<void> { }
53+
printOnStderr(formatStr?: any, ...args: any[]): void { }
4854
}
4955

5056
export class ErrorsStub implements IErrors {

lib/declarations.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ interface IOptions extends IRelease, IDeviceIdentifier, IJustLaunch, IAvd, IAvai
570570
analyticsLogFile: string;
571571
performance: Object;
572572
cleanupLogFile: string;
573-
workflow: boolean;
573+
workflow: any;
574574
setupOptions(projectData: IProjectData): void;
575575
printMessagesForDeprecatedOptions(logger: ILogger): void;
576576
}

test/stubs.ts

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ export class LoggerStub implements ILogger {
3434
}
3535

3636
printMarkdown(message: string): void { }
37+
38+
out(formatStr?: any, ...args: any[]): void { }
39+
write(...args: any[]): void { }
40+
printInfoMessageOnSameLine(message: string): void { }
41+
async printMsgWithTimeout(message: string, timeout: number): Promise<void> { }
42+
printOnStderr(formatStr?: any, ...args: any[]): void { }
3743
}
3844

3945
export class FileSystemStub implements IFileSystem {

0 commit comments

Comments
 (0)