Skip to content

fix: logger changes broke trace and some hooks #4601

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 1 commit into from
May 9, 2019
Merged
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
12 changes: 11 additions & 1 deletion lib/common/logger/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ 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 @@ -159,7 +168,8 @@ export class Logger implements ILogger {
const result: any = {};
const cleanedData = _.cloneDeep(data);

const dataToCheck = data.filter(el => typeof el === "object");
// objects created with Object.create(null) do not have `hasOwnProperty` function
const dataToCheck = data.filter(el => typeof el === "object" && el.hasOwnProperty && typeof el.hasOwnProperty === "function");

for (const element of dataToCheck) {
if (opts.length === 0) {
Expand Down