Skip to content

Commit 5224610

Browse files
committed
more change
1 parent da22eca commit 5224610

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

priv/static/phoenix_live_reload.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ let pageStrategy = channel => {
4242
window[targetWindow].location.reload()
4343
}
4444

45-
const elixirLogLevels = [
45+
const elixirLogLevels = [
4646
"emergency",
4747
"alert",
4848
"critical",
@@ -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.compareLogs(level) && this.log(level, msg))
85+
this.channel.on("log", ({msg, level}) => this.logsEnabled && this.log(level, msg))
8686
this.channel.join().receive("ok", ({editor_url}) => {
8787
this.editorURL = editor_url
8888
})
@@ -99,7 +99,7 @@ class LiveReloader {
9999

100100
setMinLogLevel(level){ this.minLogLevel = level }
101101

102-
compareLogs(level){
102+
isMinLogLevel(level){
103103
console.log("helloo")
104104
console.log(level)
105105
console.log(elixirLogLevels.indexOf(level))
@@ -148,9 +148,13 @@ class LiveReloader {
148148
}
149149

150150
log(level, str){
151-
let levelColor = level === "debug" ? "cyan" : "inherit"
152-
let consoleFunc = level === "error" ? level : "log"
153-
console[consoleFunc](`%c📡 ${str}`, `color: ${levelColor};`)
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+
}
154158
}
155159

156160
closestCallerFileLine(node){

0 commit comments

Comments
 (0)