@funda/logging v1.0.0
@funda/logging
@funda/logging
is a Vue.js plugin that provides an API for logging (via Datadog).
Features
- Provided as an npm package to every microfrontend
- Logging to Datadog for Funda
- Any console.error thrown in the browser will automatically forwarded to DataDog
Required setup
Client tokens: https://app.datadoghq.eu/organization-settings/client-tokens
On .env
file:
VUE_APP_DATADOG_CLIENT_TOKEN=pubxxxxxxxxxxxxxxxxx (Ask DevOps if unknown)
VUE_APP_DATADOG_SERVICE=your-project-name (example: listing-search-wonen
)
How to use Funda Logging on your project
Using @funda/shell
(Nuxt.js Module)
@funda/logging
works out-of-the-box when you are using @funda/shell
.
export default {
mounted(){
/**
* Log functionality to Datadog
* @param {String} message The message of your log that is fully indexed by Datadog.
* @param {Object} messageContext A valid JSON object, which includes all attributes attached to the <MESSAGE>
* @param {String} status The status of your log; accepted status values are `debug`, `info`, `warn`, or `error`.
*/
this.$fundaShell.logging.log(message, messageContext, status);
// OR
this.$fundaShell.logging.$error(message, messageContext);
this.$fundaShell.logging.$warn(message, messageContext);
this.$fundaShell.logging.$info(message, messageContext);
this.$fundaShell.logging.$debug(message, messageContext);
}
}
Using @funda/logging
For any other Vue.js project, you can also install @funda/logging
separately.
import Vue from 'vue';
import FundaLogging from '@funda/logging';
new Vue.use(FundaLogging, {
clientToken: process.env.VUE_APP_DATADOG_CLIENT_TOKEN,
service: process.env.VUE_APP_DATADOG_SERVICE,
});
FundaLogging.$log(message, messageContext, status);
Log Explorer
To check your logs:
- Login using SSO on https://app.datadoghq.eu/
- Click "Logs" on the sidebar
Filter (eg. if you are testing localhost and belong to team search):
on the "Search for:" type:
@view.url_details.host:localhost service:listing-search-wonen
Explorer logger helpers:
- Localhost:
@view.url_details.host:localhost
- Project base:
service:process.env.VUE_APP_DATADOG_SERVICE
or@service:process.env.VUE_APP_DATADOG_SERVICE
or@Site:fundashell-process.env.VUE_APP_DATADOG_SERVICE
(Replaceprocess.env.VUE_APP_DATADOG_SERVICE
with the value you set on your.env
)
Ownership
This codebase is owned by Team Accounts
For questions about this codebase contact devteam-accounts@funda.nl
3 years ago