https://github.com/eritbh/another-logger
🚥 Lightweight logging for Node.js and the browser
https://github.com/eritbh/another-logger
console logging nodejs simple
Last synced: 3 months ago
JSON representation
🚥 Lightweight logging for Node.js and the browser
- Host: GitHub
- URL: https://github.com/eritbh/another-logger
- Owner: eritbh
- License: mit
- Created: 2018-05-19T17:21:31.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-06-17T03:51:46.000Z (about 2 years ago)
- Last Synced: 2025-10-01T15:17:30.781Z (9 months ago)
- Topics: console, logging, nodejs, simple
- Language: TypeScript
- Homepage:
- Size: 830 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# another-logger [](https://www.npmjs.com/package/another-logger) [](https://www.npmjs.com/package/another-logger/v/next)
A lightweight logging utility for Node.js and the browser.
## Installation
```bash
npm install --omit dev another-logger
```
Use `--omit dev` to avoid installing this project's development dependencies.
If installing for use in browser environments only, you can also add the `--omit optional` flag, which will skip installing `ansi-colors` (used to enable color support for Node environments).
## Usage
```js
import {defaultLogger as log} from 'another-logger';
log.info('Hi there!');
```
See [USAGE.md](/USAGE.md) for a full walkthrough of the library, including logger customization and custom transports. Also see [the examples folder](/example) for complete configuration examples.
**TODO:** include docs link here as well
### Browser environments and build tools
This library is built for both CommonJS and ES6 module consumers, and for both Node.js and the browser. The module uses the `main`, `module`, and `browser` fields in its `package.json` to provide different entry points for these environments. The Node.js runtime and most build tools will use the most appropriate entry point automatically, but you may need to configure certain tools to pick up the correct version (for example, with Rollup, via the [`browser` option to `@rollup/plugin-node-resolve`](https://github.com/rollup/plugins/tree/master/packages/node-resolve#browser)).
If your setup doesn't support the `browser`/`module` fields (for example, [Typescript](https://github.com/microsoft/TypeScript/issues/7753)), you can manually specify your entry point as `another-logger/dist/index.{browser,node}.{mjs,cjs}`. For example:
```js
import {...} from 'another-logger/dist/index.browser.mjs';
```
## License
MIT © eritbh