I am currently working on developing a Vue logger plugin
export default new (class CustomLogger {
public install(Vue: any) {
Vue.prototype.$log = this;
}
error(text: string) {
console.log(text)
}
})();
This code is located in main.ts file
import customLogger from "./plugins/logger";
Vue.use(customLogger);
However, I am facing an issue where I cannot reference this.$log
in components - why?
For example, in Login.vue file:
this.$log.error("bla");
The error message reads:
Property $log does not exist on type Login