Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismccord committed Aug 25, 2023
1 parent a3a5893 commit ae581de
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions assets/js/phoenix/debug_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default class DebugSocket {
constructor(path, opts = {}){
this.socket = new Socket(path, opts)
this.debugChannel = this.socket.channel("phoenix:debugger")
this.debugChannel.on("log", ({msg, level}) => this.logsEnabled && this.log(level, msg))
this.debugChannel.join()
this.logsEnabled = false
}
Expand All @@ -12,10 +13,7 @@ export default class DebugSocket {

disconnect(){ this.socket.disconnect() }

enableLogs(){ if(this.debugChannel){ return }
this.logsEnabled = true
this.debugChannel.on("log", ({msg, level}) => this.logsEnabled && this.log(level, msg))
}
enableLogs(){ this.logsEnabled = true }

disableLogs(){ this.logsEnabled = false }

Expand Down Expand Up @@ -46,4 +44,5 @@ export default class DebugSocket {
}
if(node.parentNode){ return this.closestDebugFileLine(node.parentNode) }
}
}
}

0 comments on commit ae581de

Please sign in to comment.