diff options
| author | PliablePixels <pliablepixels@gmail.com> | 2015-08-11 15:47:11 -0400 |
|---|---|---|
| committer | PliablePixels <pliablepixels@gmail.com> | 2015-08-11 15:47:11 -0400 |
| commit | a09333e8b97a5f5c71331ce18777889510aed302 (patch) | |
| tree | 9f6b69e4996088ee13004c3bee6ea9d5f57e89db /www/lib/filelogger/dist/filelogger.js | |
| parent | 68af457b04b26e26f0414b821dabe7359e18a0ad (diff) | |
API auth tied into ZM auth, enabled client to work in both auth and non-auth mode honoring ZM's auth system
Diffstat (limited to 'www/lib/filelogger/dist/filelogger.js')
| -rw-r--r-- | www/lib/filelogger/dist/filelogger.js | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/www/lib/filelogger/dist/filelogger.js b/www/lib/filelogger/dist/filelogger.js index 28852fa8..fa5f2625 100644 --- a/www/lib/filelogger/dist/filelogger.js +++ b/www/lib/filelogger/dist/filelogger.js @@ -6,12 +6,13 @@ (function(){ /* global angular, console, cordova */ -// install : cordova plugin add cordova-plugin-file +// install : cordova plugin add cordova-plugin-file +// date format: https://docs.angularjs.org/api/ng/filter/date angular.module('fileLogger', ['ngCordova.plugins.file']) - .factory('$fileLogger', ['$q', '$window', '$cordovaFile', '$timeout', - function ($q, $window, $cordovaFile, $timeout) { + .factory('$fileLogger', ['$q', '$window', '$cordovaFile', '$timeout', '$filter', + function ($q, $window, $cordovaFile, $timeout, $filter) { 'use strict'; @@ -22,6 +23,9 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) var storageFilename = 'messages.log'; + var dateFormat; + var dateTimezone; + function isBrowser() { return (!$window.cordova && !$window.PhoneGap && !$window.phonegap); @@ -39,7 +43,9 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) level = 'INFO'; } - var timestamp = (new Date()).toJSON(); + var now = new Date(); + var timestamp = dateFormat ? + $filter('date')(now, dateFormat, dateTimezone) : now.toJSON(); var messages = Array.prototype.slice.call(arguments, 1); var message = [ timestamp, level ]; @@ -243,6 +249,19 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) } + function setTimestampFormat(format, timezone) { + if (!(angular.isUndefined(format) || angular.isString(format))) { + throw new TypeError('format parameter must be a string or undefined'); + } + if (!(angular.isUndefined(timezone) || angular.isString(timezone))) { + throw new TypeError('timezone parameter must be a string or undefined'); + } + + dateFormat = format; + dateTimezone = timezone; + } + + function checkFile() { var q = $q.defer(); @@ -299,6 +318,7 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) getLogfile: getLogfile, deleteLogfile: deleteLogfile, setStorageFilename: setStorageFilename, + setTimestampFormat: setTimestampFormat, checkFile: checkFile, debug: debug, info: info, @@ -308,4 +328,4 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) }]); -})(); +})();
\ No newline at end of file |
