relative / synchrony

javascript-obfuscator cleaner & deobfuscator
https://deobfuscate.relative.im/
GNU General Public License v3.0
840 stars 108 forks source link

Implement logger option #59

Closed e9x closed 1 year ago

e9x commented 1 year ago

Based on #26 except with an easier API.

Implementing an option feels annoying and it may be easier for users to determine the type of log based on an argument. However, I do understand why an object may be preferred.

Maybe the type for the logger can be made more explicit like:

export type Logger = typeof defaultLogger
export type Logger = (
  type: "log" | "info" | "warn" | "error",
  ...data: any[]
) => void

And maybe a "name" field can be added so the user can filter through the type of log.

All the above can be easily implemented using this groundwork.

e9x commented 1 year ago

To elaborate on the name field:

Each transformer gets it's own context (or some proxy to the main context) with the transformer's name as a [TAG].

[transformers/stringdecoder] Found variable reference