# \#logs

**URL:** https://discuss.ocaml.org/tag/logs/157.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [\[AI experiment\] attempt at message-templates implementation](https://discuss.ocaml.org/t/ai-experiment-attempt-at-message-templates-implementation/17789)

<div class="topic-metadata">

**Author:** [@rbjorklin](https://discuss.ocaml.org/u/rbjorklin)\
**Replies:** 1\
**Last updated:** [February 17, 2026, 10:46pm UTC](https://discuss.ocaml.org/t/ai-experiment-attempt-at-message-templates-implementation/17789 "2026-02-17T22:46:03Z")

</div>

A few years ago I made an arguably misguided request to get message-template support added to the Logs library. Ever since then I have felt like this should exist in the ecosystem despite it not being a natural fit with …

---

## [Spooky control flow with Format.kasprintf & friends](https://discuss.ocaml.org/t/spooky-control-flow-with-format-kasprintf-friends/12052)

<div class="topic-metadata">

**Author:** [@cemerick](https://discuss.ocaml.org/u/cemerick)\
**Replies:** 20\
**Last updated:** [May 1, 2023, 8:08pm UTC](https://discuss.ocaml.org/t/spooky-control-flow-with-format-kasprintf-friends/12052 "2023-05-01T20:08:42Z")

</div>

Recently I’ve needed to update our handling of logs to emit “structured” log messages, i.e. JSON-formatted objects with one field being the primary string log message. I’m using @dbuenzli’s logs library, so I looked to w…

---

## [Format.kprintf usage](https://discuss.ocaml.org/t/format-kprintf-usage/1396)

<div class="topic-metadata">

**Author:** [@cedlemo](https://discuss.ocaml.org/u/cedlemo)\
**Replies:** 17\
**Last updated:** [March 31, 2023, 1:15am UTC](https://discuss.ocaml.org/t/format-kprintf-usage/1396 "2023-03-31T01:15:08Z")

</div>

I am struggling to understand some code that uses the function Format.kfprintf, I understand how Format.fprintf works: utop # Format.fprintf Format.std\_formatter "@\[%s: \[%d\]@\]@." "test" 1;; test: \[1\] - : unit = () but …

---

## [How to print filenames and line numbers with the Logs library](https://discuss.ocaml.org/t/how-to-print-filenames-and-line-numbers-with-the-logs-library/8251)

<div class="topic-metadata">

**Author:** [@anchpop](https://discuss.ocaml.org/u/anchpop)\
**Replies:** 6\
**Last updated:** [August 5, 2021, 7:55am UTC](https://discuss.ocaml.org/t/how-to-print-filenames-and-line-numbers-with-the-logs-library/8251 "2021-08-05T07:55:40Z")

</div>

Hey, I’m using the Logs library. I’d like log entries to contain the filename and the line number where it was created. This is a bit tricky though - I could use \_\_FILE\_\_ and \_\_LINE\_\_ but they’re hard to use in abstract…

---

## [Custom Logs.reporter with Lwt](https://discuss.ocaml.org/t/custom-logs-reporter-with-lwt/1397)

<div class="topic-metadata">

**Author:** [@cedlemo](https://discuss.ocaml.org/u/cedlemo)\
**Replies:** 1\
**Last updated:** [January 12, 2018, 2:08pm UTC](https://discuss.ocaml.org/t/custom-logs-reporter-with-lwt/1397 "2018-01-12T14:08:53Z")

</div>

I needed to write a custom reporter that will output my logs in a file like Lwt\_log.file. Here is what I have so far: open Lwt.Infix open Logs let lwt\_file\_reporter () = let open Logs in let buf\_fmt ~like = le…
