Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. // use con.log("poop") to console.log "poop" in development
  2. // or con.stagingLog("poop") to console.log "poop" in staging
  3. // or con.prodLog("poop") to console.log "poop" in production
  4. export default {
  5. isDev() {
  6. return process.env.NODE_ENV === "development"
  7. },
  8.  
  9. isStaging() {
  10. return process.env.NODE_ENV === "staging"
  11. },
  12.  
  13. isProd() {
  14. return process.env.NODE_ENV === "production"
  15. },
  16.  
  17. log(value) {
  18. if (this.isDev) console.log(value)
  19. },
  20.  
  21. table(value) {
  22. if (this.isDev) console.table(value)
  23. },
  24.  
  25. error(value) {
  26. if (this.isDev) console.error(value)
  27. },
  28.  
  29. warn(value) {
  30. if (this.isDev) console.warn(value)
  31. },
  32.  
  33. stagingLog(value) {
  34. if (this.isStaging) console.log(value)
  35. },
  36.  
  37. stagingTable(value) {
  38. if (this.isStaging) console.table(value)
  39. },
  40.  
  41. stagingError(value) {
  42. if (this.isStaging) console.error(value)
  43. },
  44.  
  45. stagingWarn(value) {
  46. if (this.isStaging) console.warn(value)
  47. },
  48.  
  49. prodLog(value) {
  50. if (this.isProd) console.log(value)
  51. },
  52.  
  53. prodTable(value) {
  54. if (this.isProd) console.table(value)
  55. },
  56.  
  57. prodError(value) {
  58. if (this.isProd) console.error(value)
  59. },
  60.  
  61. prodWarn(value) {
  62. if (this.isProd) console.warn(value)
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement