   getAllExtraOptionsAsArray: ->
     Array.from extraOpts
 
-  log: (txt = '', obj = null) ->
-    if obj? then debugLog txt, obj else debugLog txt
+  _log: doNothing
+  Object.defineProperties @prototype,
+    log:
+      get: -> if @isEnabled() then @_log else doNothing
 
   init: ->
-    if not isRenderer
-      process.env.DEBUG = 1 if @isEnabled()
-      process.env.DEBUG_EXTRA = Array.from(extraOpts).join(',') if extraOpts.size > 0
-    else
-      @setEnabled process.env.DEBUG?
-      extraOpts = new Set(process.env.DEBUG_EXTRA?.split ',')
-    @log "Debug Mode Enabled"
+    @log "Debug Mode"
     @log "Extra Options: #{process.env.DEBUG_EXTRA}" if extraOpts.size > 0
+
+# For the Browser Process
+class DebugBrowser extends DebugBase
+  _log: (msg = '', obj = null) ->
+    txt = "[DEBUG] #{msg}".cyan
+    if obj? then console.log txt, obj else console.log txt
+
+  init: ->
+    process.env.DEBUG = 1 if @isEnabled()
+    process.env.DEBUG_EXTRA = Array.from(extraOpts).join(',') if extraOpts.size > 0
+    super()
+
+# For the Renderer Processes
+class DebugRenderer extends DebugBase
+  style = 'background: linear-gradient(30deg, cyan, white 5ex)'
+  _log: (msg = '', obj = null) ->
+    txt = "%c[DEBUG] #{msg}"
+    if obj? then console.debug txt, style, obj else console.debug txt, style
+
+  init: ->
+    @setEnabled process.env.DEBUG?
+    extraOpts = new Set(process.env.DEBUG_EXTRA?.split ',')
+    super()
+
+debug = if isRenderer then new DebugRenderer else new DebugBrowser
+
+module.exports = debug


console.assert process, "process doesn't exist"
isRenderer = process?.type is 'renderer'

enabled = false
extraOpts = new Set()

doNothing = -> return
debugLog = doNothing

setupDebugLog = ->
  if enabled
    if isRenderer
      style = 'background: linear-gradient(30deg, cyan, white 5ex)'
      debugLog = console.debug.bind console, '%c[DEBUG] %s', style
    else
      debugLog = console.log.bind console, '[DEBUG] %s'.cyan
  else
    debugLog = doNothing

# This class is only for the purpose of giving some feedbacks
# when certain function is called through the dev-tool console.

    else
      o

# Globals
console.assert process, "process doesn't exist"
isRenderer = process?.type is 'renderer'

enabled = false
extraOpts = new Set()

doNothing = -> return

# Base Implementation
class DebugBase
  setEnabled: (b) ->
    enabled = b
    Debug.wrap {enabled: b}
  enable: ->
    @setEnabled true
