-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements chat using react context as middleware
- Loading branch information
Showing
21 changed files
with
1,764 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
bigbluebutton-html5/imports/ui/components/chat/chat-logger/ChatLogger.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
|
||
class ChatLogger { | ||
constructor() { | ||
this.logLevel = 'info'; | ||
this.levels = Object.freeze({ | ||
error: 1, | ||
info: 2, | ||
debug: 3, | ||
trace: 4, | ||
}); | ||
Object.keys(this.levels).forEach((i) => { | ||
this[i] = this.logger.bind(this, i); | ||
}); | ||
} | ||
|
||
setLogLevel(level) { | ||
if (this.levels[level]) { | ||
this.logLevel = level; | ||
} else { | ||
throw new Error('This Level not exist'); | ||
} | ||
} | ||
|
||
getLogLevel() { | ||
return this.logLevel; | ||
} | ||
|
||
logger(level, ...text) { | ||
const logLevel = this.levels[level]; | ||
if (this.levels[this.logLevel] >= logLevel) { | ||
console.log(`${level}:`, ...text); | ||
} | ||
} | ||
} | ||
|
||
export default new ChatLogger(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.