1.0.6 • Published 11 months ago

log4fns v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Log4fns

asd npm.io npm.io

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.

screen shot

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