Skip to content

rcherny/log-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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.

License

See LICENSE file.

About

Simple console logging tool for JavaScript / Browser.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published