Menu

Our activity log paints three lines green that mean nothing happened, and the word the highlighter really wants only exists on our homepage
📰

Our activity log paints three lines green that mean nothing happened, and the word the highlighter really wants only exists on our homepage

DEV Community: typescript·Daniel Pertu·3 days ago
#CsqegADM
#devtotypescript#devto#dev#line#listing
Reading 0:00
15s threshold

The desktop app behind Notifio has an activity log: a black monospace box that prints what the monitor is doing. Important lines are green. That is nine lines of component:

const HIGHLIGHT_RE = / new listing | sent | found / i ;

// ... < span className = { HIGHLIGHT_RE . test ( line ) ? "font-semibold text-[#4ade80]" : "text-[#a3a3a3]" } > { line } </ span >

Enter fullscreen mode

Exit fullscreen mode

Three alternatives, one colour, no state. I went to add a fourth alternative and checked what the existing three actually catch first.

The log has exactly one author

This part makes the audit tractable. Every line in that box comes from one function in one module:

function log ( msg : string ) : void { const line = `[${new Date().toLocaleTimeString()}] ${msg}` ; console . log ( line ) ; _logListeners .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.