Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // use con.log("poop") to console.log "poop" in development
- // or con.stagingLog("poop") to console.log "poop" in staging
- // or con.prodLog("poop") to console.log "poop" in production
- export default {
- isDev() {
- return process.env.NODE_ENV === "development"
- },
- isStaging() {
- return process.env.NODE_ENV === "staging"
- },
- isProd() {
- return process.env.NODE_ENV === "production"
- },
- log(value) {
- if (this.isDev) console.log(value)
- },
- table(value) {
- if (this.isDev) console.table(value)
- },
- error(value) {
- if (this.isDev) console.error(value)
- },
- warn(value) {
- if (this.isDev) console.warn(value)
- },
- stagingLog(value) {
- if (this.isStaging) console.log(value)
- },
- stagingTable(value) {
- if (this.isStaging) console.table(value)
- },
- stagingError(value) {
- if (this.isStaging) console.error(value)
- },
- stagingWarn(value) {
- if (this.isStaging) console.warn(value)
- },
- prodLog(value) {
- if (this.isProd) console.log(value)
- },
- prodTable(value) {
- if (this.isProd) console.table(value)
- },
- prodError(value) {
- if (this.isProd) console.error(value)
- },
- prodWarn(value) {
- if (this.isProd) console.warn(value)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement