We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a5d65e4 commit 1eba65cCopy full SHA for 1eba65c
src/logger.ts
@@ -111,3 +111,22 @@ export class VueLogger {
111
isValidOptions(options: ILoggerOptions, logLevels: string[]): boolean {
112
return isValidOptions(options, logLevels);
113
}
114
+
115
+ static register(key: string) {
116
+ return {
117
+ // eslint-disable-next-line
118
+ install: (Vue: any, options: ILoggerOptions) => {
119
+ options = Object.assign(getDefaultOptions(), options);
120
+ if (isValidOptions(options, LOG_LEVELS)) {
121
+ Vue.provide(key, createLogger(options));
122
+ } else {
123
+ throw ERROR_MSG;
124
+ }
125
+ },
126
+ };
127
128
+}
129
130
+export function createLogger(options: ILoggerOptions): VueLoggerInstance {
131
+ return new VueLoggerInstance(options);
132
0 commit comments