Added logging module
This commit is contained in:
@@ -5,6 +5,7 @@ import Events from './events.js'
|
||||
import {DOMFlip, DOMFlippable, CardLoader, PDFLoader, ImageLoader, FrameLoader, HTMLLoader} from './flippable.js'
|
||||
import Index from './index.js'
|
||||
import Interface from './interface.js'
|
||||
import Logging from './logging.js'
|
||||
import Poppable from './poppable.js'
|
||||
import PopupMenu from './popupmenu.js'
|
||||
import Popup from './popup.js'
|
||||
@@ -60,6 +61,7 @@ window.InteractionDelta = InteractionDelta
|
||||
window.InteractionMapper = InteractionMapper
|
||||
window.InteractionPoints = InteractionPoints
|
||||
window.Interface = Interface
|
||||
window.Logging = Logging
|
||||
window.PointMap = PointMap
|
||||
window.Rect = Rect
|
||||
window.Points = Points
|
||||
|
||||
+2
-6
@@ -4,6 +4,7 @@
|
||||
import Interface from './interface.js'
|
||||
import { Points, Angle, MapProxy } from './utils.js'
|
||||
import Events from './events.js'
|
||||
import Logging from './logging.js'
|
||||
|
||||
/** Interaction patterns
|
||||
|
||||
@@ -916,11 +917,6 @@ export class InteractionMapper extends InteractionDelegate {
|
||||
this.logInteractionsAbove = logInteractionsAbove
|
||||
}
|
||||
|
||||
log(message) {
|
||||
let logger = (typeof app != 'undefined' && app.log) ? app : console
|
||||
logger.log(message)
|
||||
}
|
||||
|
||||
get targetInterface() {
|
||||
return IInteractionMapperTarget
|
||||
}
|
||||
@@ -943,7 +939,7 @@ export class InteractionMapper extends InteractionDelegate {
|
||||
let size = this.interaction.current.size
|
||||
let limit = this.logInteractionsAbove
|
||||
if (size > limit) {
|
||||
this.log(`Number of interactions ${size} exceeds ${limit}`)
|
||||
Logging.log(`Number of interactions ${size} exceeds ${limit}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/** Basic class for app specific logging requirements.
|
||||
* Can be used to implement persistent logging in electron apps.
|
||||
*/
|
||||
export default class Logging {
|
||||
|
||||
/** Static log function.
|
||||
* @param {*} message
|
||||
*/
|
||||
log(message) {
|
||||
console.log(message)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user