# Using ppx\_deriving.show for trace messages

**URL:** <https://discuss.ocaml.org/t/using-ppx-deriving-show-for-trace-messages/12662>\
**Category:** Learning\
**Tags:** ppx\_deriving\
**Created:** [July 22, 2023, 12:14am UTC](https://discuss.ocaml.org/t/using-ppx-deriving-show-for-trace-messages/12662 "2023-07-22T00:14:45Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [July 22, 2023, 1:42am UTC](https://discuss.ocaml.org/t/using-ppx-deriving-show-for-trace-messages/12662/11 "2023-07-22T01:42:50Z")

</div>

Oh, I understand that you need to grep things. That’s what Perl scripts are for, eh? A Perl script like:

```auto
$/ = "%|%" ;
while (<>) {
  print $_ if $_ =~ /foo bar buzz/s;
}

```

and of course, it’s trivial to make a version that takes a cmdline pattern. And compiles that pattern into a thunk before the while-loop.

Again going back to Java, stack-tracebacks are common. When I build large systems in OCaml they’re common also. So grepping isn’t very useful: I don’t want the _line_ containing the pattern I was searching for, but rather the _log-record_. And as I showed above, it’s pretty trivial to write a script to grep on log-records, not lines.

---

_[View the full topic](https://discuss.ocaml.org/t/using-ppx-deriving-show-for-trace-messages/12662)._
