Skip to content

Commit

Permalink
chore: Revert "chore: Serialize object arguments in desktop runtime (#…
Browse files Browse the repository at this point in the history
…18359)" (#18382)

This reverts commit c93b3d0.
  • Loading branch information
thisisamir98 authored Nov 26, 2024
1 parent 3347355 commit 3c85467
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/script/util/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,15 @@
*
*/

import {LogFactory, Logger, Runtime} from '@wireapp/commons';
import {LogFactory, Logger} from '@wireapp/commons';

const LOGGER_NAMESPACE = '@wireapp/webapp';

function serializeArgs(args: any[]): any[] {
return args.map(arg => (typeof arg === 'object' && arg !== null ? JSON.stringify(arg) : arg));
}

function getLogger(name: string): Logger {
const logger = LogFactory.getLogger(name, {
return LogFactory.getLogger(name, {
namespace: LOGGER_NAMESPACE,
separator: '/',
});

if (Runtime.isDesktopApp()) {
return {
...logger,
debug: (...args: any[]): void => {
logger.debug(...serializeArgs(args));
},
error: (...args: any[]): void => {
logger.error(...serializeArgs(args));
},
info: (...args: any[]): void => {
logger.info(...serializeArgs(args));
},
log: (...args: any[]): void => {
logger.log(...serializeArgs(args));
},
warn: (...args: any[]): void => {
logger.warn(...serializeArgs(args));
},
};
}

return logger;
}

export {getLogger, LOGGER_NAMESPACE, Logger};

0 comments on commit 3c85467

Please sign in to comment.