@strong-roots-capital/trace
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

trace

Build Status

tap function to log a value with optional tag

Install

npm install @strong-roots-capital/trace

Use

import { trace } from "@strong-roots-capital/trace";

import Debug from "debug";
import * as O from "fp-ts/Option";
import { pipe } from "fp-ts/function";

const debug = Debug("defaults");

// If user has specified concurrency, will print on the debug stream:
// "concurrency 4"
const concurrency = pipe(
  O.fromNullable(getUserConcurrency()),
  O.pipe(trace(debug, "concurrency")),
  O.getOrElse(() => 1)
);

Note: also works with console.{info,log,warn,error}

API

trace

trace: (logger: typeof console.log, ...tag: unknown[]) =>
  <T>(value: T) =>
    T;

unsafeTraceJson

trace: (logger: typeof console.log, ...tag: unknown[]) =>
  <T>(value: T) =>
    T;

IOtrace

trace: (logger: typeof console.log, ...tag: unknown[]) =>
  <T>(value: T) =>
  () =>
    T;

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.1
    2
  • 1.2.0
    16,901
  • 1.1.0
    0
  • 1.0.1
    0
  • 1.0.0
    1

Package Sidebar

Install

npm i @strong-roots-capital/trace

Weekly Downloads

2,424

Version

1.2.1

License

ISC

Unpacked Size

8.33 kB

Total Files

7

Last publish

Collaborators

  • hamroctopus
  • amchelle