Adds more tracking all around the app (#142)
* Adds more tracking all around the app * more events * lint * using better analytics naming * missed file * more fixes
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
export class Logger {
|
||||
isDisabled: boolean
|
||||
|
||||
constructor(isDisabled: boolean = process.env.NODE_ENV === 'production') {
|
||||
this.isDisabled = isDisabled
|
||||
}
|
||||
|
||||
enable() {
|
||||
this.isDisabled = false
|
||||
}
|
||||
|
||||
disable() {
|
||||
this.isDisabled = true
|
||||
}
|
||||
|
||||
info(message?: any, ...optionalParams: any[]): void {
|
||||
if (!this.isDisabled) {
|
||||
console.info(message, ...optionalParams)
|
||||
}
|
||||
}
|
||||
|
||||
warn(message?: any, ...optionalParams: any[]): void {
|
||||
if (!this.isDisabled) {
|
||||
console.warn(message, ...optionalParams)
|
||||
}
|
||||
}
|
||||
|
||||
error(message?: any, ...optionalParams: any[]): void {
|
||||
if (!this.isDisabled) {
|
||||
console.error(message, ...optionalParams)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const createLogger = (isDisabled?: boolean) => new Logger(isDisabled)
|
||||
@@ -0,0 +1,9 @@
|
||||
import {createClient} from '@segment/analytics-react-native'
|
||||
// import {createLogger} from './logger'
|
||||
|
||||
export const segmentClient = createClient({
|
||||
writeKey: '8I6DsgfiSLuoONyaunGoiQM7A6y2ybdI',
|
||||
trackAppLifecycleEvents: true,
|
||||
// Uncomment to debug:
|
||||
// logger: createLogger(),
|
||||
})
|
||||
Reference in New Issue
Block a user