haskell / haskell/cabal

Make notice/warn/debug and friends thread safe

Open
#4,357 10 comments 1 reaction 0 assignees View on GitHub
attention: pr-welcome re: user experience type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

At the moment, they are only as thread safe as a call to hPutStr is; in other words, not very.

The best way to fix this without introducing global mutable state is to finally implement the logging infrastructure for Verbosity that I've been muttering about:

1. Augment Verbosity with logger functions that it will call when it otherwise wanted to emit to stdout/stderr
2. Make a new smart constructor for Verbosity that lives in IO, and allocates a logging thread, and initializes the logger function to send a message to the logging thread.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing Verbosity paths that emit to stdout and stderr, then review how hPutStr is used. The issue describes adding logger functions and an IO smart constructor that allocates a logging thread; done means notice, warn, debug, and related calls are thread safe without global mutable state.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.