Let's say I have a logging class called Logger.
let log = new Logger(...);
Is it possible to specify a magic method in that class to be executed when the class instance is invoked as function? For example
log(...)
In php implementing the __invoke() magic method of a class achieves the same thing.
Logger
constructor, but it will be an arbitrary function not an instance (not inheriting fromLogger.prototype
)