Skip to content

Commit 59bc978

Browse files
committed
fix oop
1 parent 5224610 commit 59bc978

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

priv/static/phoenix_live_reload.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class LiveReloader {
8282
let reloadStrategy = reloadStrategies[msg.asset_type] || reloadStrategies.page
8383
setTimeout(() => reloadStrategy(this.channel), interval)
8484
})
85-
this.channel.on("log", ({msg, level}) => this.logsEnabled && this.log(level, msg))
85+
this.channel.on("log", ({msg, level}) => this.logsEnabled && this.isMinLogLevel(level) && this.log(level, msg))
8686
this.channel.join().receive("ok", ({editor_url}) => {
8787
this.editorURL = editor_url
8888
})
@@ -100,12 +100,7 @@ class LiveReloader {
100100
setMinLogLevel(level){ this.minLogLevel = level }
101101

102102
isMinLogLevel(level){
103-
console.log("helloo")
104-
console.log(level)
105-
console.log(elixirLogLevels.indexOf(level))
106-
console.log(elixirLogLevels.indexOf(this.minLogLevel))
107-
console.log(elixirLogLevels.indexOf(level) <= elixirLogLevels.indexOf(this.minLogLevel))
108-
elixirLogLevels.indexOf(level) <= elixirLogLevels.indexOf(this.minLogLevel)
103+
return elixirLogLevels.indexOf(level) <= elixirLogLevels.indexOf(this.minLogLevel)
109104
}
110105

111106
openEditorAtCaller(targetNode){
@@ -148,13 +143,9 @@ class LiveReloader {
148143
}
149144

150145
log(level, str){
151-
console.log("log")
152-
if (this.isMinLogLevel(level)) {
153-
console.log("logging")
154-
let levelColor = level === "debug" ? "cyan" : "inherit"
155-
let consoleFunc = level === "error" ? level : "log"
156-
console[consoleFunc](`%c📡 ${str}`, `color: ${levelColor};`)
157-
}
146+
let levelColor = level === "debug" ? "cyan" : "inherit"
147+
let consoleFunc = level === "error" ? level : "log"
148+
console[consoleFunc](`%c📡 ${str}`, `color: ${levelColor};`)
158149
}
159150

160151
closestCallerFileLine(node){

0 commit comments

Comments
 (0)