Logging #247
matthew-carroll
announced in
Technical Proposal
Logging
#247
Replies: 1 comment
-
For now I've brought in the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Logging is something that every programmer does, but every programmer does it differently, and often without much thought.
The current state of logging in
super_editor
is very poor. The logger is either on or off, and when it's on, the console quickly fills with noise. Sometimes part of that noise is important, but whatever portion you're interested in is interspersed with noise that you're not interested in. Moreover, it's unclear what the purpose of any given log message might be.This proposal outlines some notes on what might constitute effective logging, and how we might achieve it.
Effective Logging
Notes from "Logging in JavaScript Best Practices"
Log statements should make clear the following details:
Types of logging:
Golden rules:
Everything you wanted to know about logging
Logging can be thought of as:
Log Levels
RFC 5424 - The Syslog Protocol
https://datatracker.ietf.org/doc/html/rfc5424
Syslog offers the following log levels:
NPM offers the following log levels:
The most important/critical level is the lowest number.
Log Shipping
AKA "transports", "streams", "appenders"
Recommends that these should always be streams. Streams offer back-pressure out of the box.
Querying & Streaming
Want to do some kind of analysis on the logs. Solutions for this are typically SAAS products that are made for log analysis.
Serialization & Filtering
The final representation, e.g., JSON, pretty-printed string.
Defaults & Mutation
Logging should provide defaults, but allow alteration of defaults over time.
AKA "serializers", "tokens", "patterns"
Thoughts on logging
super_editor
logs might be used for the following purposes:Describing objects
Effective handling of log messages is required, but is not sufficient for effective logging. Various
super_editor
objects need to provide useful serializations for logging purposes. For example, every change applied to a document should be logged, and that change should produce a useful serialization (perhaps one serialization for humans and another for robots).Here's a concept for a
Describable
interface:If this description mechanism is adopted, most objects in
super_editor
should implementDescribable
. This is especially true for all document change events and attributed spans and text.Major tracing areas
There are specific
super_editor
behavior areas that are important for tracing:Beta Was this translation helpful? Give feedback.
All reactions