https://github.com/rcherny/log-tool
Simple console logging tool for JavaScript / Browser.
https://github.com/rcherny/log-tool
browser debugging javascript logger logging
Last synced: over 1 year ago
JSON representation
Simple console logging tool for JavaScript / Browser.
- Host: GitHub
- URL: https://github.com/rcherny/log-tool
- Owner: rcherny
- License: mit
- Created: 2020-05-18T17:22:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T18:47:23.000Z (over 5 years ago)
- Last Synced: 2025-02-02T05:43:54.637Z (over 1 year ago)
- Topics: browser, debugging, javascript, logger, logging
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Log Tool
Exceptionally minimal browser console log tool.
## Features
- tiny footprint
- preserve line numbers in console
- enable/disable loggers and keep them in the code
- No dependencies
# Example
To run the example, run a static server in this root folder, and load [the eample page](example/index.html) in a browser.
## Using
Simply import the module and run with it.
```
import { logTool } from '@rmc2/log-tool';
// Create a logger:
const loggerA = logTool(true, {
namespace: 'Logging Module A:'
})
loggerA('log any value as necessary'); // Logging Module A: log any value as necessary
// Disabled:
const loggerB = logTool(false, {
namespace: 'Logging Module B:'
})
loggerB('This has no output'); // Disabled, no output.
// return to first logger
loggerA('Logging more things.'); // Logging Module A: Logging more things.
// Simple defaults
const loggerC = logTool();
loggerC('Logging!') // Logging!
```
## Todo
- [ ] Change so you do no have to pass a method in to use a different method
- [ ] Use session storage for global overrides
- [ ] Actual unit tests
- [ ] Less verbose API
- [ ] Push to npm (...)
## Other Logging Tools
There are much fancier tools. Really.
- [Log Level](https://github.com/pimterry/loglevel "GitHub - pimterry/loglevel: Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods")
- [Min Log](https://github.com/chunpu/min-log "GitHub - chunpu/min-log: Better Logger with Custom Level and Outputer Taking over the original console")
## License
See LICENSE file.