-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One file per achievement record #954
Conversation
(</> "achievements") <$> getSwarmDataPath createDirs | ||
getSwarmAchievementsPath createDirs = do | ||
dp <- getSwarmDataPath False | ||
let achievementsDir = dp </> "achievement" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name from achievements
to achievement
so that any recent players of the game don't get an error due to that path not being a directory.
] | ||
let (bads, goods) = partitionEithers eithersList | ||
forM_ bads $ \b -> | ||
hPutStrLn stderr $ T.unpack b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don’t put stuff to stderr.
We have a RuntimeState with logs for this purpose.
Let me describe why:
- I run the game
- an error is printed shortly before Brick opens
- I play Swarm puzzled why some things are wrong
- I close the game and see the log
- I wonder why I am only seeing this now and not in game notifications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let's log using the existing mechanism. Could you please illustrate how? I've pushed a commit atop this branch with an incomplete attempt.
4655e1d
to
ddf0056
Compare
@kostmo I hope you won't mind if I rebase this and force-push with the fix of the WIP commit. 🙂 You got it 99% right, it's just that in |
ddf0056
to
f918325
Compare
* split logs into a separate module * make some logs warnings and fatal (to be continued...) * prepare failure logging infrastructure for TUI This should be merged before #954 so it is not squashed.
f918325
to
cca5e1d
Compare
@kostmo if you are satisfied with this, feel free to merge. 🙂 |
🥳 |
Closes #953
Testing
First, earn a couple of achievements by playing the game. Then, stuff some garbage into the
achievement
directory and rerun the game:Observe that the game starts fine and is able to display our original 2 achievements.