graphql-engine/server/src-lib/Hasura
Gil Mizrahi 904029aa7d Add fancier trace debugging functions to Hasura.Prelude
## Suggestion: Add fancier trace debugging functions to `Hasura.Prelude`

This PR adds two trace functions, `ltrace` and `ltraceM`, which use the `pretty-simple` package to `show` the input with nice formatting and colors for ease of reading (and comparing using diff tools such as `meld` or `vim-diff`).

I've also added warning pragmas to the functions, which means:
1. Traces will not be left in code, as CI builds with -Werror
2. Developers will have to change the `ghc-options` to `-Wwarn` in their `cabal.project.local` settings to use these functions

### Example

Usage:

```hs
selectFunctionAggregate ... = ... do
  ltraceM "functionInfo" function
  ...
```

Output to terminal looks like this:

<img width="524" alt="Screen Shot 2021-08-12 at 10 33 24" src="https://user-images.githubusercontent.com/8547573/129158878-4a5e96ba-30a5-452c-8f33-9eb4b2cc5e2a.png">

### Dependencies

Requires adding the following dependencies:
  - prettyprinter-ansi-terminal-1.1.2 (BSD2)
  - pretty-simple-4.0.0.0 (BSD3)

Question: what is the process for adding new dependencies? How does decisions on this matter happen?

https://github.com/hasura/graphql-engine-mono/pull/2075

GitOrigin-RevId: 490b0f0ca595da319b43e92e190ba50c0b132cd5
2021-08-12 19:33:56 +00:00
..
Backends server: inherited roles for mutations, remote schemas, actions and custom functions 2021-08-09 10:21:05 +00:00
Base Clean some instances 2021-07-30 15:43:32 +00:00
Cache server: remove remnants of query plan caching (fix #1795) 2021-07-27 11:52:43 +00:00
Eventing server: add support for tagged and dynamic metrics 2021-08-05 21:08:17 +00:00
GraphQL server: correctly generate remote relationship field type 2021-08-12 12:17:52 +00:00
Incremental server: inherited roles for mutations, remote schemas, actions and custom functions 2021-08-09 10:21:05 +00:00
Metadata server: fix cron trigger bug of new events not getting generated when cron trigger is imported via metadata 2021-05-26 16:20:19 +00:00
RQL server: document metadata versioning 2021-08-09 12:44:41 +00:00
Server server: support EdDSA keys for JWT 2021-08-12 01:54:06 +00:00
SQL kill Arbitrary (fix #1736) 2021-07-30 07:55:37 +00:00
App.hs Revert "Disable TLS checks for actions services with self-signed certificates" 2021-08-06 17:06:55 +00:00
EncJSON.hs Remote schema execution logic 2021-08-06 13:40:37 +00:00
GC.hs server: simplify shutdown logic, improve resource management (#218) (#195) 2020-12-21 18:56:57 +00:00
HTTP.hs improve debug information in actions errors response (close #4031) (#4432) 2020-04-24 13:25:51 +05:30
Incremental.hs Build the GraphQL context after pruning dangling dependents 2020-01-30 18:17:29 -06:00
Logging.hs server: generalized LogQueryLog (fix #708) 2021-03-13 14:41:44 +00:00
Prelude.hs Add fancier trace debugging functions to Hasura.Prelude 2021-08-12 19:33:56 +00:00
QueryTags.hs server: SQL query tags for GQL operations (closes #400) 2021-07-29 08:30:10 +00:00
Session.hs kill Arbitrary (fix #1736) 2021-07-30 07:55:37 +00:00
Tracing.hs Remote Schema Customization take 2 using parser tranformations 2021-07-30 11:33:59 +00:00