Clearer logging when developing
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- react-native, typescript
- Bereich
- developer-experience, observability
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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;
}
}
- Vorherrschende Sprache
- TypeScript
- Sterne
- 383
- Forks
- 207
- Ø Merge
- 4 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus segmentio/analytics-react-native
-
chunk() never resets its size counter: past 500 KB every queued event is uploaded as its own requestOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
segmentio/analytics-react-native#1334 · 1 Reaktion ·
-
Typo in `useSegmentEndpoints` client option in READMEEvtl. vergeben @abueide hat das vor 55 Tagen übernommen. Offenbug investigate
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
segmentio/analytics-react-native#1145 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
segmentio/analytics-react-native#1337 · 2 Kommentare ·
-
Support react-native-appsflyer 7.x (plugin calls APIs removed in 7.0.0)Evtl. vergeben @andr3wV hat das vor 17 Tagen übernommen. Offenenhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 68/100
segmentio/analytics-react-native#1328 · 1 Kommentar · 1 Reaktion ·
-
`chunk()` returns a sparse array when one event exceeds `maxKB`, stalling the event queue (regression in 2.23.0)Evtl. vergeben @Mohitingale13 hat das vor 57 Tagen übernommen. Offenbug investigate
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 78/100
segmentio/analytics-react-native#1309 ·
Alle Issues in segmentio/analytics-react-native
Ähnliche Issues
-
[Bug]: Device screenshot fails with 500 on iPhone Duo (Xcode 27.2): serve-sim calls simctl without --displayEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
pingdotgg/t3code#24900 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
inu-appcenter/UNIDorm-web#411 ·
Maintainer antworten meist innerhalb von 1 Tag
-
🐛 bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
ranxianglei/billion-context#4720 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:arcade game p3-medium ready-for-agent type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
fderuiter/deruiter.dev#2840 ·
Maintainer antworten meist innerhalb von 1 Tag