1. Start
  2. An entity
  3. A source
  4. A rule
  5. A port
  6. A link
  7. A fact
  8. An app
  9. Split

Stand in front of the port

We log every mail without touching the handler or the mailer. A class that implements the mailer and asks for it stands in front of it.

fronds/blog/services/AuditMailer.ts
1import type { Logger } from '@fougere/core';
2import type Mailer from './Mailer.js';
3
4export default class AuditMailer implements Partial<Mailer> {c
5 constructor(private inner: Mailer, private log: Logger) {}a
6
7 async send(subject: string): Promise<void> {
8 this.log.info('sending', subject);b
9
10 return this.inner.send(subject);
11 }
12}

point at a lettered line, or tap it, to see what grows from it

0 line changed under handlers/

Around a capability, not inside it.

Try it
$ curl -X POST localhost:4100/api/blog/posts/$ID/publish
INF [app:blog:AuditMailer] (blog:PostHandler.publish) sending Published: Hi
mail: Published: Hi
Built with Fougere and Nuxt, hosted on GitHub Pages.