@cca-io/rescript-logger

    2.0.0 • Public • Published

    rescript-logger

    Simple logger library for ReScript apps.

    Design Goals

    1. Do not require a PPX, but still provide a way to include the module name in the log output.
    2. Pluggable logger implementation so that code shared between e.g. React and React Native can use a platform-specific implementation.

    Installation

    # yarn
    yarn add @cca-io/rescript-logger
    
    # or npm
    npm install @cca-io/rescript-logger

    Then add rescript-logger to the dependencies in your bsconfig.json, e.g.:

    {
      "name": "my-app",
      ...
      "bs-dependencies": ["@rescript/react", "@cca-io/rescript-logger"],
      ...
    }
    

    Usage

    Example:

    module Log = unpack(ResLogger.make(__MODULE__))
    
    Log.info("Starting")
    
    // ...
    
    Log.error2("Startup error", error)

    The actual logger implementation is pluggable, so it can be swapped out e.g. for usage with React Native:

    ResLogger.setLoggerImpl(module(MyNativeLoggerImpl))

    Install

    npm i @cca-io/rescript-logger

    DownloadsWeekly Downloads

    1

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    6.49 kB

    Total Files

    8

    Last publish

    Collaborators

    • fham_
    • cknittel
    • hendriksp