[GHC] #9837: Introduce a logging API to GHC

#9837: Introduce a logging API to GHC -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- I don't have a lot of mileage with the code base, but I do see that there is no standard logging API that the various components can use (or there is and it just needs to be used??). At least, I would expect to see a standard API to generate log entries with the following minimal parts: * timestamp * Log level - for example, ERROR, WARN, INFO, DEBUG, TRACE (-v[1-3] could map to INFO, DEBUG and TRACE. Log levels are inclusive so INFO also means WARN and ERROR. * Component name - so we know what is the source of the log message. At least I would expect to see (Desugarer, Typechecker, Parser, etc) * the message It would also mean a single back-end to collect the log messages and dump them to a file, stdout/stderr, etc. There are many other features beyond this point (customize log messages, colors, filtering, etc), but in terms of the API that is used throughout the code base, it should be simple. Was this already discussed in the past? Is there already such an API in the codebase? Is there an existing library that we could use to achieve the same? Any other ideas? This ticket is mostly to spawn a discussion about it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9837 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9837: Introduce a logging API to GHC -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by carter): I think the ghc events log already provides the machinery for this sort of thing. I dont think that those notions of log levels necessarily make sense in the RTS though. (though i could be wrong) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9837#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9837: Introduce a logging API to GHC -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rodlogic): Yes, I opened the ticket thinking about the compiler not the runtime. Right now if you turn the verbosity on you will see a blob of output that is hard to parse and could benefit from a tidy up. Maybe the current v[1-3] is already good enough, I think the main point is to centralize logging. Again, if there is a pattern to this that I am missing here, please let me know. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9837#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9837: Introduce a logging API to GHC -------------------------------------+------------------------------------- Reporter: rodlogic | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): Can you describe an intended consumer of such a log? To my knowledge, there is no centralized logging structure, per se, although there are plenty of `-d` flags that dump log-like output. There is some central management of these flags, but I don't think there's a ton of consistency about this. However, before trying to shore this up, it would be helpful to know what a consumer would look like. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9837#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC