Skip to content
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

Extend logs for warnings #982

Merged
merged 3 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename s/leSaid/leSource/g
  • Loading branch information
xsebek committed Jan 8, 2023
commit df9f9ab906cf2246d85a0d97ee1865055361a5fe
4 changes: 2 additions & 2 deletions src/Swarm/Game/Log.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Swarm.Game.Log (
-- * Robot log entries
LogEntry (..),
leText,
leSaid,
leSource,
leRobotName,
leTime,
leLocation,
Expand Down Expand Up @@ -58,7 +58,7 @@ data LogEntry = LogEntry
{ _leTime :: Integer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fields sound French 😜

-- ^ The time at which the entry was created.
-- Note that this is the first field we sort on.
, _leSaid :: LogSource
, _leSource :: LogSource
-- ^ Whether this log records a said message.
, _leRobotName :: Text
-- ^ The name of the robot that generated the entry.
Expand Down
4 changes: 2 additions & 2 deletions src/Swarm/TUI/View.hs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ messagesWidget gs = widgetList
txt2 = txtWrapWith indent2

colorLogs :: LogEntry -> AttrName
colorLogs e = case e ^. leSaid of
colorLogs e = case e ^. leSource of
Said -> robotColor (e ^. leRobotID)
Logged -> notifAttr
ErrorTrace l -> case l of
Expand Down Expand Up @@ -1115,7 +1115,7 @@ drawLogEntry :: Bool -> LogEntry -> Widget a
drawLogEntry addName e = withAttr (colorLogs e) . txtWrapWith indent2 $ if addName then name else t
where
t = e ^. leText
name = "[" <> view leRobotName e <> "] " <> (if e ^. leSaid == Said then "said " <> quote t else t)
name = "[" <> view leRobotName e <> "] " <> (if e ^. leSource == Said then "said " <> quote t else t)

------------------------------------------------------------
-- REPL panel
Expand Down