log4fns
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Log4fns

asd

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

Package Sidebar

Install

npm i log4fns

Weekly Downloads

3

Version

1.0.6

License

ISC

Unpacked Size

20.1 kB

Total Files

10

Last publish

Collaborators

  • wilsonchyw