@dill-pixel/plugin-rollbar
Version:
Rollbar
37 lines (36 loc) • 1.17 kB
JavaScript
import { Plugin as r, Logger as e, isDev as s } from "dill-pixel";
import i from "rollbar";
const n = "6.2.3", t = "2.26.4", a = {
isDev: !1,
enabled: !0,
captureUncaught: !0,
captureUnhandledRejections: !0,
debug: s
};
class u extends r {
get rollbar() {
return this._rollbar;
}
hello() {
const o = `%c Dill Pixel Rollbar Plugin v${n} | %cRollbar v${t}`;
console.log(
o,
"background: rgba(31, 41, 55, 1);color: #74b64c",
"background: rgba(31, 41, 55, 1);color: #e91e63",
"background: rgba(31, 41, 55, 1);color: #74b64c"
), this._options.debug && e.log(this._options);
}
async initialize(o, l) {
if (this._options = {
accessToken: l.env.VITE_ROLLBAR_ACCESS_TOKEN || l.env.ROLLBAR_ACCESS_TOKEN,
...a,
...o
}, !this._options.accessToken)
throw new Error("Rollbar accessToken is required");
this._rollbar = new i(this._options), this.hello(), this._options.isDev ? (e.warn("Rollbar is disabled in development mode"), this._rollbar.configure({ enabled: !1 })) : e.log("Rollbar is enabled");
}
}
export {
u as default
};
//# sourceMappingURL=dill-pixel-plugin-rollbar.mjs.map