1.0.6 • Published 11 months ago
log4fns v1.0.6
Log4fns
A very lightweight Javascript utility that logs the function name and location from where it is called. Useful for bug tracking during software development. Support both ESM and CommonJS.
Install
This project uses node and npm.
npm install log4fns
Usage
Import
// ESM
import Log from "log4fns"
// CommonJS
const Log = require("log4fns").default
Optional
// If you are using a remote enviornment and want to get the correct local time
// or you want to change the default timezone
Log.setTimeZone("Your time zone")
// If you need to ouput the function name and path in Production
Log.setShowDetailInProduction(true)
Example
/** index.js */
import Log from "log4fns"
function test(){
Log("hello world")
}
test()
output
12/3/2022, 2:34:37 AM | index.js:3 | test | hello world