diff options
author | Victor Häggqvist <[email protected]> | 2016-01-13 17:05:44 +0100 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2016-01-13 17:05:44 +0100 |
commit | a6b949e31a4c511f25dcf7f0fc0dda2bab862739 (patch) | |
tree | da3d13a5c6b341a5501d0108a999cdb11c27d1b5 /src/Log/Log.js | |
parent | 489015e2558f528e1d6f988f3f03c8f3633c0256 (diff) |
basic working click on image
Diffstat (limited to '')
-rw-r--r-- | src/Log/Log.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/Log/Log.js b/src/Log/Log.js new file mode 100644 index 0000000..e01d9dc --- /dev/null +++ b/src/Log/Log.js @@ -0,0 +1,52 @@ +/** + * Created by Victor Häggqvist on 1/12/16. + */ + +import {LogLevel} from './LogLevel' + +export class Log { + + //var instance = null; + static init() { + Log.level = LogLevel.DEBUG; + } + + static silence() { + Log.level = LogLevel.SILENT; + } + + static l(msg) { + Log.log(msg, 'log'); + } + + static w(msg) { + Log.log(msg, 'warn'); + } + + static d(msg) { + Log.log(msg, 'debug'); + //console.debug(Log.explode(msg)); + } + + static log(args, type='log') { + let baked = Log.explode(args); + + if (Log.level === LogLevel.SILENT) return; + + switch (type) { + case 'info': return console.info(baked); + case 'log': return console.log(baked); + case 'warn': return console.warn(baked); + case 'debug': return console.debug(baked); + } + + } + + static explode(args) { + if (!Array.isArray(args)) { + return args; + } + + return args; + } +} |