Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/hyogwa/src/log.ts>Log

Natural 🌿 effect system that fits TypeScript
Latest
interface Log
import { type Log } from "https://deno.land/x/hyogwa@v0.1.0-rc.4/src/log.ts";

Effect spec template for logging effects (a.k.a. 'Writer')

Examples

Simple application logging in console

import { Effect, createPrimitives, Effectful } from 'hyogwa/core'
import { Log } from 'hyogwa/log'
import { unsafeRunSync } from 'hyogwa/runners'

type Console = Effect<'Console', Log<string>>
const Console = createPrimitives<Console>('Console')

function* main(): Effectful<Console, void> {
  yield* Console.log('HI!')
  yield* Console.log('BYE!')
}

unsafeRunSync(main(), {
  Console: {
    log(text, { resume }) {
      console.log(text)
      resume()
    }
  }
})

Methods

log(representation: T): void