Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-bee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-bee
Commits
95d7e390
Commit
95d7e390
authored
Aug 27, 2024
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
review: consider removing putStrLn
parent
9dfec964
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
REVIEW.md
REVIEW.md
+17
-0
No files found.
REVIEW.md
View file @
95d7e390
...
...
@@ -72,3 +72,20 @@ src/Async/Worker.hs:277:22: error: [-Wredundant-constraints, -Werror=redundant-c
As the name implies,
`Debug.Trace`
& co are really only for debugging purposes, and is not recommended
to leave them in library code,
`traceStack`
being a primary example.
# Remove calls to `putStrLn`; Consider adding a \"pluggable\" tracing mechanism
At the moment errors and other events are simply printed to stdout, which is not very ideal for a few reasons:
*
They gets interleaved with normal output (including test runs), making output garbled;
*
The user is not given a choice how to separate normal logging (on stdout) vs errors (typically on
`stderr`
,
which is not the case here); maybe users would rather be interested to see errors elsewhere (example: a log file);
*
Logging can't be disabled or filtered, which might be useful in some contexts.
There are ways to solve this; the classic approach is to simply pick a logging library of choice and stick with
it; the mode modern/scalable approach is using inversion of control for adding contravariant tracing in the vein
of
[
contra-tracer
](
https://hackage.haskell.org/package/contra-tracer-0.2.0.0/docs/Control-Tracer.html
)
or
[
co-log
](
https://hackage.haskell.org/package/co-log
)
. In this style the broker (or the functions using the
broker, your mileage might vary) would gain an extra parameter (like a
`Tracer`
if using contra-tracer) and
then it's up to the caller to pick the concrete implementation for the logger, and the library would use
the opaque interface (that's the simplified TL;DR).
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment