-
Notifications
You must be signed in to change notification settings - Fork 9
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
First attempt at logging to files instead of std out #135
Conversation
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.
Looks good to me. Not sure how to unit test this but shouldn't break anything either way so worth trying.
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.
Damn good initiative if I may say so myself!
See the comments for confusion, hearts and questions!
@@ -37,6 +37,7 @@ import System.Console.GetOpt ( ArgDescr(..) | |||
, getOpt | |||
, usageInfo | |||
) | |||
import System.Directory ( createDirectoryIfMissing ) |
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.
🎉 IT EXISTS FOR REAL! 🎉
app/Main.hs
Outdated
@@ -54,6 +55,7 @@ opts :: [OptDescr (Config -> Config)] | |||
opts = | |||
[ Option [] ["help"] (NoArg (set cHelp True)) "Show usage info" | |||
, Option [] ["port"] (ReqArg (set cPort . read) "PORT") "Port to run on" | |||
, Option [] ["path"] (ReqArg (set cLogPath) "PATH") "Path to save log files to, default is 'logs'" |
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.
, Option [] ["path"] (ReqArg (set cLogPath) "PATH") "Path to save log files to, default is 'logs'" | |
, Option [] ["path"] (ReqArg (set cLogPath) "PATH") "Path to save log files to, default is 'logs'" |
Columns <3
@@ -71,6 +73,7 @@ main = (recreateConfig . getOpt Permute opts <$> getArgs) >>= \case | |||
(config , _ , _ ) -> do | |||
upd <- newEmptyMVar -- putMVar when to update | |||
viewRef <- createViewReference | |||
createDirectoryIfMissing True (_cLogPath config) |
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.
Is this path relative?
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.
Or maybe both?
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.
Both absolute and relative that is
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.
It handles both :D 🗡️
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.
AWESOME! I am now a much calmer human.
src/Model.hs
Outdated
import Data.AffineSpace ( (.+^) ) | ||
import Data.Thyme ( _localDay | ||
, _localTimeOfDay | ||
, _todHour | ||
, _zonedTimeToLocalTime | ||
, getZonedTime | ||
, getZonedTime, getCurrentTime |
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.
, getZonedTime, getCurrentTime | |
, getCurrentTime | |
, getZonedTime |
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.
Newlines and lexicographic ordering <3
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.
Looks good, just a minor indentation fix
src/Model.hs
Outdated
import Model.Linsen | ||
import Text.Printf (printf) |
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.
Minor indentation fix
import Model.Linsen | |
import Text.Printf (printf) | |
import Model.Linsen | |
import Text.Printf (printf) |
Something just struck me, this is me thinking aloud, I think it's faster and uses less resources to write to file as a |
Ignored 🗡️ |
d5fc2be
to
db3740f
Compare
db3740f
to
0235a8b
Compare
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've done art! You can use it if you want to. 😸
No description provided.