Moved to new ui log format.

This commit is contained in:
Martin Edenhofer 2014-10-18 16:02:46 +02:00
parent b3639e67b0
commit 12938c77a7

View file

@ -24,7 +24,8 @@ 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 = 'https://portal.znuny.com/api/ui' # @url = 'https://log.znuny.com/api/ui'
@url = 'https://portal.znuny.com/api/v1/ui'
# @url = 'api/ui' # @url = 'api/ui'
@log( 'start', 'notice', {} ) @log( 'start', 'notice', {} )
@ -89,14 +90,14 @@ class _trackSingleton
return return
) )
log: ( area, level, args ) -> log: ( facility, level, args ) ->
return if !App.Config.get('ui_send_client_stats') return if !App.Config.get('ui_send_client_stats')
info = info =
time: Math.round( new Date().getTime() / 1000 ) time: Math.round( new Date().getTime() / 1000 )
area: area facility: facility
level: level level: level
location: window.location.href location: window.location.pathname + window.location.hash
data: args message: args
@data.push info @data.push info
send: (async = true) => send: (async = true) =>
@ -110,9 +111,6 @@ class _trackSingleton
itemNew = _.clone( item ) itemNew = _.clone( item )
JSON.stringify(item) JSON.stringify(item)
# add browser info
for item, value of @browser
itemNew[item] = value
newDataNew.push itemNew newDataNew.push itemNew
catch e catch e
# nothing # nothing
@ -122,8 +120,12 @@ class _trackSingleton
url: @url url: @url
async: async async: async
data: JSON.stringify( data: JSON.stringify(
track_id: @trackId meta:
log: newDataNew track_id: @trackId
host: window.location.host
protocol: window.location.protocol
browser: @browser
log: newDataNew
) )
crossDomain: true crossDomain: true
# success: (data, status, xhr) => # success: (data, status, xhr) =>