Merge branch 'develop' into interface

This commit is contained in:
Martin Edenhofer 2014-10-19 20:14:04 +02:00
commit 500b11c86b

View file

@ -24,9 +24,9 @@ class _trackSingleton
@trackId = 'track-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 ) @trackId = 'track-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
@browser = App.Browser.detection() @browser = App.Browser.detection()
@data = [] @data = []
# @url = 'http://localhost:3005/api/v1/ui'
# @url = 'https://log.znuny.com/api/ui' # @url = 'https://log.znuny.com/api/ui'
@url = 'https://portal.znuny.com/api/v1/ui' @url = 'https://portal.znuny.com/api/v1/ui'
# @url = 'api/ui'
@log( 'start', 'notice', {} ) @log( 'start', 'notice', {} )
@ -60,13 +60,25 @@ class _trackSingleton
# log ajax calls # log ajax calls
$(document).bind( 'ajaxComplete', ( e, request, settings ) => $(document).bind( 'ajaxComplete', ( e, request, settings ) =>
length = @url.length
if settings.url.substr(0,length) isnt @url && settings.url.substr(0,6) isnt 'api/ui' # do not log ui requests
if settings.url && settings.url.substr(settings.url.length-3,3) isnt '/ui'
level = 'notice' level = 'notice'
responseText = '' responseText = ''
if request.status >= 400 if request.status >= 400
level = 'error' level = 'error'
responseText = request.responseText responseText = request.responseText
if settings.data
# add length limitation
if settings.data.length > 3000
settings.data = settings.data.substr(0,3000)
# delete passwords form data
if typeof settings.data is 'string'
settings.data = settings.data.replace(/"password":".+?"/gi, '"password":"xxx"')
@log( @log(
'ajax.send', 'ajax.send',
level, level,
@ -85,7 +97,7 @@ class _trackSingleton
$(window).bind( $(window).bind(
'beforeunload' 'beforeunload'
=> =>
@log( 'end', 'notice', {} ) @log( 'good bye', 'notice', {} )
@send(false) @send(false)
return return
) )