Clearer logging when developing
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react-native, typescript
- Ambito
- developer-experience, observability
Direzione di ricerca
No source files or tests are named. Start by locating the configuration and the default event logging path, then compare it with the custom Logger plugin described in the issue. Done means custom event logging can be used without overwriting the logger or disabling unrelated debug and error logs.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Our use case:
Visualize all the events in the app from the developer tools console tab. Currently they are quite hard to differentiate
We decided to create a custom plugin since we want to log each event with some nice CSS (Yes, the console supports a limited subset of CSS(!)). But for this implementation it would nice to remove the default logging behaviour of events, but without needing to overwrite the logging instance. I would prefer to have an API or abstraction level where I only work with events.
With our custom plugin we have to disable "debug", but that would probably swallow some imporant logs. We did add a errorHandler though
Proposed Solution
Add a disableDefaultLoggingOfEvents:boolean to the config. Or make it easier to handle events in the Logger
Here is our logger for the curious
/* eslint-disable no-console */
import { PluginType, Plugin } from '@segment/analytics-react-native';
export class LoggerPlugin extends Plugin {
type = PluginType.after;
execute(event: any) {
// This is actually a SegmentEvent, but we use 'any' because its such a pain to make correct
try {
const version = event.context?.protocols?.event_version ?? 1;
const kind = event.type?.toUpperCase() === 'SCREEN' ? 'SCREEN' : 'TRACK';
const tag = `[${kind}V${version}]`;
const name = (event.type === 'screen' ? event.name : event.event) || event.name || 'Unknown Event';
const props = event.properties ?? {};
const tagStyle =
version === 1
? 'background:#0969da;color:#fff;padding:1px 6px;border-radius:999px;font-weight:700'
: 'background:#8250df;color:#fff;padding:1px 6px;border-radius:999px;font-weight:700';
const nameStyle =
'background:rgba(9,105,218,0.18);color:#e6edf3;padding:1px 6px;border-radius:8px;font-weight:800;font-size:12.5px';
const sepStyle = 'color:#8b949e';
console.log(
'%c%s %c%s %c',
tagStyle,
tag,
nameStyle,
name,
sepStyle,
props
);
} catch (error) {
console.error('[LoggerPlugin] Error logging event:', error);
console.log('Event data:', event);
}
return event;
}
}
- Lingua principale
- TypeScript
- Stelle
- 384
- Fork
- 205
- Merge medio
- 4h 10m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di segmentio/analytics-react-native
-
chunk() never resets its size counter: past 500 KB every queued event is uploaded as its own requestAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
segmentio/analytics-react-native#1334 · 1 reazione ·
-
Typo in `useSegmentEndpoints` client option in READMEForse già presa @abueide l’ha presa 34 giorni fa. Apertabug investigate
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
segmentio/analytics-react-native#1145 ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
segmentio/analytics-react-native#1328 ·
-
`chunk()` returns a sparse array when one event exceeds `maxKB`, stalling the event queue (regression in 2.23.0)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug investigate
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
segmentio/analytics-react-native#1309 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
segmentio/analytics-react-native#1124 · 3 commenti ·
Tutte le issue di segmentio/analytics-react-native
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AOSSIE-Org/DebateAI#611 ·
I maintainer di solito rispondono entro 3 giorni
-
Upgrade node-libzim to 4.7.0Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
openzim/mwoffliner#2933 ·
I maintainer di solito rispondono entro 1 giorno
-
Use the README category name for website links and submissionsForse già presa @dajiaohuang l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
birobirobiro/awesome-shadcn-ui#647 ·
I maintainer di solito rispondono entro 2 giorni
-
Twake Drive picker: closePicker() never destroys the intent (stop() is on the promise returned by start(), not by create())Forse già presa @chibenwa l’ha presa oggi. Apertaclaude
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
linagora/twake-calendar-frontend#1498 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Add: Valea Prahovei TV RO SDApertacheck:passed streams:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno