Safe Haskell | Safe-Inferred |
---|
This is a standalone program to monitor the log file.
It reads lines and streams them to the GUI, which displays them in
a scrolling box. Clickable text is surrounded by {}
s and will be
highlighted blue in the GUI. When it's clicked, the GUI sends the tag
back, much like an HTML href. For example, stack traces are formatted as
a REPL cmd that will highlight that location on the score.
The top line is the status bar, which extracts and remembers bits of
specially formatted log msgs. This effectively functions as the app's
global status bar, since otherwise it has no place for this kind of
information. The configuration is default_catch_patterns
.
This also maintains a filter. The filter is a little language that will
filter out messages that don't match, documented by
Process.compile_filter
.
In addition, there is a concept of Process.CatchPattern
s. These are
regexes which are matched against msg text. When one matches, the matched
groups are kept in a status line. That way, events reported in the log can
be collected together.
Synopsis
- pid_file :: FilePath
- initial_filter :: Text
- initial_size :: (Int, Int)
- default_catch_patterns :: [Process.CatchPattern]
- default_history :: Int
- default_max_bytes :: Int
- data Flag
- options :: [GetOpt.OptDescr Flag]
- type LogChan = TChan.TChan Log.Msg
- main :: IO ()
- logview :: [Flag] -> IO ()
- write_pid :: IO (Maybe ProcessID)
- gui :: Maybe FltkUtil.Geometry -> Fltk.Channel -> LogChan -> FilePath -> Int -> IO ()
- print_logs :: LogChan -> IO ()
- data Msg
- handle_msgs :: Fltk.Channel -> Process.State -> Int -> LogChan -> LogViewC.Window -> IO ()
- strip_paths :: Text -> Log.Msg -> Log.Msg
- handle_new_msg :: Fltk.Channel -> LogViewC.Window -> Log.Msg -> StateT Process.State IO ()
- handle_clicked_word :: Text -> IO ()
- send_action :: MonadIO m => Fltk.Channel -> Fltk.Fltk () -> m ()
- send_to_seq :: Text -> IO ()
- get_msg :: LogChan -> LogViewC.Window -> IO Msg
- parse_ui_msg :: Fltk.Msg LogViewC.MsgType -> Msg
Documentation
initial_filter :: Text Source #
Initial contents of the filter field.
initial_size :: (Int, Int) Source #
default_catch_patterns :: [Process.CatchPattern] Source #
Built-in list of catch patterns.
I wound up having the app emit catch patterns explicitly instead of putting
the smarts in logview, so now the only CatchPattern is
Process.global_status_pattern
. But it still seems conceivable that
someday I may want logview to catch things the app didn't explicitly mean to
be caught, so I'll leave this functionality in for now.
default_history :: Int Source #
Remember this many log msgs.
default_max_bytes :: Int Source #
UI will remember this many bytes. This is not the same as
default_history
because the history will remember filtered out msgs, and
the UI doesn't bother to preserve msg boundaries so it uses bytes.
options :: [GetOpt.OptDescr Flag] Source #
type LogChan = TChan.TChan Log.Msg Source #
write_pid :: IO (Maybe ProcessID) Source #
If a logview is already running, return its pid, otherwise write the current pid.
gui :: Maybe FltkUtil.Geometry -> Fltk.Channel -> LogChan -> FilePath -> Int -> IO () Source #
print_logs :: LogChan -> IO () Source #
handle_msgs :: Fltk.Channel -> Process.State -> Int -> LogChan -> LogViewC.Window -> IO () Source #
strip_paths :: Text -> Log.Msg -> Log.Msg Source #
Internally I use absolute paths, but they're pretty verbose. So turn them back into relative paths.
handle_new_msg :: Fltk.Channel -> LogViewC.Window -> Log.Msg -> StateT Process.State IO () Source #
handle_clicked_word :: Text -> IO () Source #
send_action :: MonadIO m => Fltk.Channel -> Fltk.Fltk () -> m () Source #
send_to_seq :: Text -> IO () Source #