1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actioncable/app/javascript/action_cable/logger.js
2020-07-06 23:32:55 +05:30

22 lines
478 B
JavaScript

import adapters from "./adapters"
// The logger is disabled by default. You can enable it with:
//
// ActionCable.logger.enabled = true
//
// Example:
//
// import * as ActionCable from '@rails/actioncable'
//
// ActionCable.logger.enabled = true
// ActionCable.logger.log('Connection Established.')
//
export default {
log(...messages) {
if (this.enabled) {
messages.push(Date.now())
adapters.logger.log("[ActionCable]", ...messages)
}
},
}