
Security News
Frontier AI Is Now Critical Infrastructure
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.
logger-for-cannot-duplicate
Advanced tools
A light logger system for browser for the case which can not duplicate but sometimes happened.
[ENGLISH] | 中文
A light logger system for browser.
zero dependence
Log useful info to indexedDB to send to server for analysis Default to use navigator.sendBeacon to upload and not support to fail back to xhr
Open test.html to experience
import Logger from 'logger-for-cannot-duplicate';
//support more one instances
const logger = new Logger({
//if isDevEnv is true, it will print console, including logger-for-cannot-duplicate config, default value: false
isDevEnv: true,
//indexedDB to put log info, default value: logger-for-cannot-duplicate
dbName: 'db',
//your server to receive log infos, default value: ""
serverAddr: 'put your log server addr here',
//put package.json info here
packageInfo: {},
//upload package usage url, default value: 'https://api-track.kylin.shuyun.com/monitor-service/upload-package-info'
uploadPackageInfoUrl: '',
//enable logger, default value: true
enable: true,
});
//Due to initialize indexedDB is async, so if read or remove or add will return a result named pending
//it's better to instance Logger first and then to use. e.g. init Logger when project launch
//debug level not log to indexedDB
logger.debug('this is debug info');
logger.info('this is info info');
logger.warn('this is warn info');
logger.error('this is error info');
//logger.show will print console even if isDevEnv is false or undefined
logger.show('this is show level info');
//add one log to indexedDB
logger.add('123456');
logger.add(true);
logger.showData();
//read logs in indexDB collection, init indexedDB require some time,
//please wait indexedDB prepare and then call logger method
//other method will save actions to queue and execute util indexedDB init success
logger.read().then(result => {
console.log('result', result);
//remove that indexDB collection
// logger.remove();
//only clear indexedDB data
logger.clearData();
//send log infos to server, also can call send without read
logger.send(result, 'myLogId');
});
There are nine apis at present and are easy to use.
debug:
Only print info on console when isDevEnv is true, not save to indexedDB
info:
Standard logger print when isDevEnv is true, print info on console and save in indexedDB
warn:
Print warn info on console when isDevEnv is true and save in indexedDB
error:
Print error info on console when isDevEnv is true and save in indexedDB
show:
Print info on console even if isDevEnv is false, and save to indexedDB
showData:
show all data in specify indexedDB collection
log:
Print log info on console when isDevEnv is true and save in indexedDB
add:
Add one log info to indexedDB to save
read:
Read log infos from specify indexedDB
remove:
Remove specify indexedDB database
clearData:
clear specify indexedDB database data
send:
Send log infos to your server
FAQs
A light logger system for browser for the case which can not duplicate but sometimes happened.
We found that logger-for-cannot-duplicate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.