Added client side logging (#9643)

This commit is contained in:
Keith Holliday 2017-12-11 11:07:16 -06:00 committed by GitHub
parent a7c115877f
commit 507133c76e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 1 deletions

View file

@ -71,6 +71,7 @@
},
"IAP_GOOGLE_KEYDIR": "/path/to/google/public/key/dir/",
"LOGGLY_TOKEN": "token",
"LOGGLY_CLIENT_TOKEN": "token",
"LOGGLY_ACCOUNT": "account",
"PUSH_CONFIGS": {
"GCM_SERVER_API_KEY": "",

View file

@ -34,7 +34,7 @@ let env = {
},
};
'NODE_ENV BASE_URL GA_ID STRIPE_PUB_KEY FACEBOOK_KEY GOOGLE_CLIENT_ID AMPLITUDE_KEY PUSHER:KEY PUSHER:ENABLED'
'NODE_ENV BASE_URL GA_ID STRIPE_PUB_KEY FACEBOOK_KEY GOOGLE_CLIENT_ID AMPLITUDE_KEY PUSHER:KEY PUSHER:ENABLED LOGGLY_CLIENT_TOKEN'
.split(' ')
.forEach(key => {
env[key] = `"${nconf.get(key)}"`;

View file

@ -20,6 +20,7 @@
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="//cloudfront.loggly.com/js/loggly.tracker-latest.min.js" async></script>
<!-- Translations -->
<script type='text/javascript' src='/api/v3/i18n/browser-script'></script>
</body>

View file

@ -0,0 +1,9 @@
export function setUpLogging () {
let _LTracker = window._LTracker || []; // eslint-disable-line
_LTracker.push({ // eslint-disable-line
logglyKey: process.env.LOGGLY_CLIENT_TOKEN, // eslint-disable-line no-process-env
sendConsoleErrors: true,
tag: 'ClientJS',
json: true,
});
}

View file

@ -7,6 +7,7 @@ import AppComponent from './app';
import {
setup as setupAnalytics,
} from 'client/libs/analytics';
import { setUpLogging } from 'client/libs/logging';
import router from './router';
import getStore from './store';
import StoreModule from './libs/store';
@ -32,6 +33,7 @@ Vue.use(i18n, {i18nData: window && window['habitica-i18n']});
Vue.use(StoreModule);
Vue.use(BootstrapVue);
setUpLogging();
setupAnalytics(); // just create queues for analytics, no scripts loaded at this time
const store = getStore();