Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cca-io/rescript-logger
Simple logger library for ReScript apps.
https://github.com/cca-io/rescript-logger
logger logging rescript
Last synced: 4 months ago
JSON representation
Simple logger library for ReScript apps.
- Host: GitHub
- URL: https://github.com/cca-io/rescript-logger
- Owner: cca-io
- License: mit
- Created: 2018-12-04T15:16:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-27T07:47:39.000Z (over 3 years ago)
- Last Synced: 2024-10-04T06:02:49.624Z (4 months ago)
- Topics: logger, logging, rescript
- Language: ReScript
- Homepage:
- Size: 11.7 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rescript-logger
Simple logger library for [ReScript](https://rescript-lang.org/) 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
```shell
# 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:
```rescript
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:
```rescript
ResLogger.setLoggerImpl(module(MyNativeLoggerImpl))
```