From a09333e8b97a5f5c71331ce18777889510aed302 Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Tue, 11 Aug 2015 15:47:11 -0400 Subject: API auth tied into ZM auth, enabled client to work in both auth and non-auth mode honoring ZM's auth system --- www/lib/filelogger/.bower.json | 12 ++++++------ www/lib/filelogger/README.md | 8 ++++++++ www/lib/filelogger/bower.json | 2 +- www/lib/filelogger/dist/filelogger.js | 30 +++++++++++++++++++++++++----- www/lib/filelogger/dist/filelogger.min.js | 2 +- www/lib/filelogger/package.json | 2 +- 6 files changed, 42 insertions(+), 14 deletions(-) (limited to 'www/lib/filelogger') diff --git a/www/lib/filelogger/.bower.json b/www/lib/filelogger/.bower.json index 2f6314c0..ff9be55e 100644 --- a/www/lib/filelogger/.bower.json +++ b/www/lib/filelogger/.bower.json @@ -1,6 +1,6 @@ { "name": "filelogger", - "version": "1.2.0", + "version": "1.3.0", "homepage": "https://github.com/pbakondy/filelogger", "authors": [ "Peter Bakondy " @@ -27,14 +27,14 @@ "file logger" ], "license": "MIT", - "_release": "1.2.0", + "_release": "1.3.0", "_resolution": { "type": "version", - "tag": "v1.2.0", - "commit": "34d8cc57c16c842ec757cc078e9385286b2ff1c4" + "tag": "v1.3.0", + "commit": "9500dca94558ffb27de6416c6031ddf54e183265" }, "_source": "git://github.com/pbakondy/filelogger.git", - "_target": "~1.2.0", + "_target": "~1.3.0", "_originalSource": "filelogger", "_direct": true -} +} \ No newline at end of file diff --git a/www/lib/filelogger/README.md b/www/lib/filelogger/README.md index b1e3c20f..e0e29aa3 100644 --- a/www/lib/filelogger/README.md +++ b/www/lib/filelogger/README.md @@ -68,6 +68,14 @@ Wrapper for $fileLogger.log('error', ...) You can set the local filename (default messages.log). It requests one parameter, the filename (type string). +### $fileLogger.setTimestampFormat(format, timezone) + +You can customize the timestamp format using [Angular date filter](https://docs.angularjs.org/api/ng/filter/date). See formatting parameters on the linked Angular docs page. Example: + +```js +$fileLogger.setTimestampFormat('medium'); +``` + ### $fileLogger.getLogfile() You can read the whole logfile from the filestore. This method returns a promise. diff --git a/www/lib/filelogger/bower.json b/www/lib/filelogger/bower.json index fb4b8fe2..3ec2e262 100644 --- a/www/lib/filelogger/bower.json +++ b/www/lib/filelogger/bower.json @@ -1,6 +1,6 @@ { "name": "filelogger", - "version": "1.2.0", + "version": "1.3.0", "homepage": "https://github.com/pbakondy/filelogger", "authors": [ "Peter Bakondy " 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 diff --git a/www/lib/filelogger/dist/filelogger.min.js b/www/lib/filelogger/dist/filelogger.min.js index b0f555a3..4fd8ec79 100644 --- a/www/lib/filelogger/dist/filelogger.min.js +++ b/www/lib/filelogger/dist/filelogger.min.js @@ -3,4 +3,4 @@ * Copyright 2015 Peter Bakondy https://github.com/pbakondy * See LICENSE in this repository for license information */ -!function(){angular.module("fileLogger",["ngCordova.plugins.file"]).factory("$fileLogger",["$q","$window","$cordovaFile","$timeout",function(e,o,n,r){"use strict";function l(){return!o.cordova&&!o.PhoneGap&&!o.phonegap}function t(e){angular.isString(e)?(e=e.toUpperCase(),-1===m.indexOf(e)&&(e="INFO")):e="INFO";for(var o,n=(new Date).toJSON(),r=Array.prototype.slice.call(arguments,1),t=[n,e],c=0;c0?(F=e,!0):!1}function f(){var r=e.defer();return l()?r.resolve({name:F,localURL:"localStorage://localhost/"+F,type:"text/plain",size:o.localStorage[F]?o.localStorage[F].length:0}):n.checkFile(cordova.file.dataDirectory,F).then(function(e){e.file(r.resolve,r.reject)},r.reject),r.promise}function g(){var e=Array.prototype.slice.call(arguments,0);e.unshift("DEBUG"),t.apply(void 0,e)}function p(){var e=Array.prototype.slice.call(arguments,0);e.unshift("INFO"),t.apply(void 0,e)}function y(){var e=Array.prototype.slice.call(arguments,0);e.unshift("WARN"),t.apply(void 0,e)}function d(){var e=Array.prototype.slice.call(arguments,0);e.unshift("ERROR"),t.apply(void 0,e)}var v=[],h=!1,m=["DEBUG","INFO","WARN","ERROR"],F="messages.log";return{log:t,getLogfile:i,deleteLogfile:s,setStorageFilename:u,checkFile:f,debug:g,info:p,warn:y,error:d}}])}(); +!function(){angular.module("fileLogger",["ngCordova.plugins.file"]).factory("$fileLogger",["$q","$window","$cordovaFile","$timeout","$filter",function(e,o,n,r,t){"use strict";function a(){return!o.cordova&&!o.PhoneGap&&!o.phonegap}function l(e){angular.isString(e)?(e=e.toUpperCase(),-1===O.indexOf(e)&&(e="INFO")):e="INFO";for(var o,n=new Date,r=m?t("date")(n,m,F):n.toJSON(),l=Array.prototype.slice.call(arguments,1),c=[r,e],s=0;s0?(R=e,!0):!1}function g(e,o){if(!angular.isUndefined(e)&&!angular.isString(e))throw new TypeError("format parameter must be a string or undefined");if(!angular.isUndefined(o)&&!angular.isString(o))throw new TypeError("timezone parameter must be a string or undefined");m=e,F=o}function p(){var r=e.defer();return a()?r.resolve({name:R,localURL:"localStorage://localhost/"+R,type:"text/plain",size:o.localStorage[R]?o.localStorage[R].length:0}):n.checkFile(cordova.file.dataDirectory,R).then(function(e){e.file(r.resolve,r.reject)},r.reject),r.promise}function d(){var e=Array.prototype.slice.call(arguments,0);e.unshift("DEBUG"),l.apply(void 0,e)}function y(){var e=Array.prototype.slice.call(arguments,0);e.unshift("INFO"),l.apply(void 0,e)}function v(){var e=Array.prototype.slice.call(arguments,0);e.unshift("WARN"),l.apply(void 0,e)}function h(){var e=Array.prototype.slice.call(arguments,0);e.unshift("ERROR"),l.apply(void 0,e)}var m,F,S=[],b=!1,O=["DEBUG","INFO","WARN","ERROR"],R="messages.log";return{log:l,getLogfile:s,deleteLogfile:u,setStorageFilename:f,setTimestampFormat:g,checkFile:p,debug:d,info:y,warn:v,error:h}}])}(); \ No newline at end of file diff --git a/www/lib/filelogger/package.json b/www/lib/filelogger/package.json index 165d6598..a3cc3938 100644 --- a/www/lib/filelogger/package.json +++ b/www/lib/filelogger/package.json @@ -2,7 +2,7 @@ "name": "filelogger", "private": false, "main": "dist/filelogger", - "version": "1.2.0", + "version": "1.3.0", "repository": { "url": "git://github.com/pbakondy/filelogger.git" }, -- cgit v1.2.3