Added logging module

This commit is contained in:
Uwe Oestermeier 2019-05-24 09:53:27 +02:00
parent becb749e02
commit 7f4b7fb1ff
5 changed files with 45 additions and 18 deletions

21
dist/iwmlib.js vendored
View File

@ -1545,6 +1545,19 @@
} }
/** Basic class for app specific logging requirements.
* Can be used to implement persistent logging in electron apps.
*/
class Logging {
/** Static log function.
* @param {*} message
*/
log(message) {
console.log(message);
}
}
/* globals Hammer, propagating */ /* globals Hammer, propagating */
/** Interaction patterns /** Interaction patterns
@ -2456,11 +2469,6 @@
this.logInteractionsAbove = logInteractionsAbove; this.logInteractionsAbove = logInteractionsAbove;
} }
log(message) {
let logger = (typeof app != 'undefined' && app.log) ? app : console;
logger.log(message);
}
get targetInterface() { get targetInterface() {
return IInteractionMapperTarget return IInteractionMapperTarget
} }
@ -2483,7 +2491,7 @@
let size = this.interaction.current.size; let size = this.interaction.current.size;
let limit = this.logInteractionsAbove; let limit = this.logInteractionsAbove;
if (size > limit) { if (size > limit) {
this.log(`Number of interactions ${size} exceeds ${limit}`); Logging.log(`Number of interactions ${size} exceeds ${limit}`);
} }
} }
@ -7368,6 +7376,7 @@
window.InteractionMapper = InteractionMapper$1; window.InteractionMapper = InteractionMapper$1;
window.InteractionPoints = InteractionPoints; window.InteractionPoints = InteractionPoints;
window.Interface = Interface; window.Interface = Interface;
window.Logging = Logging;
window.PointMap = PointMap; window.PointMap = PointMap;
window.Rect = Rect; window.Rect = Rect;
window.Points = Points; window.Points = Points;

20
dist/iwmlib.pixi.js vendored
View File

@ -4709,6 +4709,19 @@
// } // }
} }
/** Basic class for app specific logging requirements.
* Can be used to implement persistent logging in electron apps.
*/
class Logging {
/** Static log function.
* @param {*} message
*/
log(message) {
console.log(message);
}
}
/* globals Hammer, propagating */ /* globals Hammer, propagating */
/** Interaction patterns /** Interaction patterns
@ -5620,11 +5633,6 @@
this.logInteractionsAbove = logInteractionsAbove; this.logInteractionsAbove = logInteractionsAbove;
} }
log(message) {
let logger = (typeof app != 'undefined' && app.log) ? app : console;
logger.log(message);
}
get targetInterface() { get targetInterface() {
return IInteractionMapperTarget return IInteractionMapperTarget
} }
@ -5647,7 +5655,7 @@
let size = this.interaction.current.size; let size = this.interaction.current.size;
let limit = this.logInteractionsAbove; let limit = this.logInteractionsAbove;
if (size > limit) { if (size > limit) {
this.log(`Number of interactions ${size} exceeds ${limit}`); Logging.log(`Number of interactions ${size} exceeds ${limit}`);
} }
} }

View File

@ -5,6 +5,7 @@ import Events from './events.js'
import {DOMFlip, DOMFlippable, CardLoader, PDFLoader, ImageLoader, FrameLoader, HTMLLoader} from './flippable.js' import {DOMFlip, DOMFlippable, CardLoader, PDFLoader, ImageLoader, FrameLoader, HTMLLoader} from './flippable.js'
import Index from './index.js' import Index from './index.js'
import Interface from './interface.js' import Interface from './interface.js'
import Logging from './logging.js'
import Poppable from './poppable.js' import Poppable from './poppable.js'
import PopupMenu from './popupmenu.js' import PopupMenu from './popupmenu.js'
import Popup from './popup.js' import Popup from './popup.js'
@ -60,6 +61,7 @@ window.InteractionDelta = InteractionDelta
window.InteractionMapper = InteractionMapper window.InteractionMapper = InteractionMapper
window.InteractionPoints = InteractionPoints window.InteractionPoints = InteractionPoints
window.Interface = Interface window.Interface = Interface
window.Logging = Logging
window.PointMap = PointMap window.PointMap = PointMap
window.Rect = Rect window.Rect = Rect
window.Points = Points window.Points = Points

View File

@ -4,6 +4,7 @@
import Interface from './interface.js' import Interface from './interface.js'
import { Points, Angle, MapProxy } from './utils.js' import { Points, Angle, MapProxy } from './utils.js'
import Events from './events.js' import Events from './events.js'
import Logging from './logging.js'
/** Interaction patterns /** Interaction patterns
@ -916,11 +917,6 @@ export class InteractionMapper extends InteractionDelegate {
this.logInteractionsAbove = logInteractionsAbove this.logInteractionsAbove = logInteractionsAbove
} }
log(message) {
let logger = (typeof app != 'undefined' && app.log) ? app : console
logger.log(message)
}
get targetInterface() { get targetInterface() {
return IInteractionMapperTarget return IInteractionMapperTarget
} }
@ -943,7 +939,7 @@ export class InteractionMapper extends InteractionDelegate {
let size = this.interaction.current.size let size = this.interaction.current.size
let limit = this.logInteractionsAbove let limit = this.logInteractionsAbove
if (size > limit) { if (size > limit) {
this.log(`Number of interactions ${size} exceeds ${limit}`) Logging.log(`Number of interactions ${size} exceeds ${limit}`)
} }
} }

12
lib/logging.js Normal file
View File

@ -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)
}
}