SocksLog is a logging utility that allows you to log messages with different levels (INFO, WARN, ERROR) both locally and remotely.
- Log messages with different levels: INFO, WARN, ERROR
- Remote logging to a database
- Client for real-time log streaming
- TypeScript support
- Non-blocking background logging
- Proper error stack trace handling
- Automatically fully unpacks objects and arrays
npm install sockslog
Then create an account on https://kvs.wireway.ch and create a database and copy its ID from the URL and the access token using the button.
const logger = require('sockslog');
logger.setup({
noRemote: true
});
logger.info('Hello World');
const logger = require('sockslog');
logger.setup({
accessToken: 'ENTER_YOUR_ACCESS_TOKEN',
kvsId: 'ENTER_YOUR_ID'
});
logger.info('Hello World');
const logger = require('sockslog');
logger.setup({
noRemote: true
});
try {
throw new Error('Something went wrong');
} catch (err) {
logger.error(err); // Will properly display the full stack trace
}
const logger = require('sockslog');
logger.setup({
accessToken: 'ENTER_YOUR_ACCESS_TOKEN',
kvsId: 'ENTER_YOUR_ID'
});
logger.client()
import logger from 'sockslog';
logger.setup({
noRemote: true
});
logger.info('Hello World');
import logger from 'sockslog';
logger.setup({
accessToken: 'ENTER_YOUR_ACCESS_TOKEN',
kvsId: 'ENTER_YOUR_ID'
});
logger.info('Hello World');
import logger from 'sockslog';
logger.setup({
noRemote: true
});
try {
throw new Error('Something went wrong');
} catch (err) {
logger.error(err); // Will properly display the full stack trace
}
import logger from 'sockslog';
logger.setup({
accessToken: 'ENTER_YOUR_ACCESS_TOKEN',
kvsId: 'ENTER_YOUR_ID'
});
logger.client();