1.1.7 • Published 4 years ago

log-smth v1.1.7

Weekly downloads
38
License
-
Repository
-
Last release
4 years ago

log-smth

This is a custom logging library I'm currently, working on, feel free to use it.

import { Logger } from './index';

const logger: Logger = new Logger({
    timestamps: true, // If logs should show the timestamp too.
    defaultLog: 'log', // The default log type to use.
    logFileOptions: {
        logFile: true, // Whether you should use a log file or not.
        logDirPath: process.cwd(), // Where the log file should be stored.
        logLevels: ['error', 'warn'], // Which log levels should be logged.
        fileType: 'txt', // Which filetype should be used for the log file.
        logStack: true, // Whether stack traces should be logged or not.
        pipeText: true, // Whether streams should be used or not. ( Not compatible with JSON )
    },
    callback: (options: { message: string; logLevel: string }) => { // Yeah, a callback function. Awesome, right? 
        console.log(options.message); // This function'll run everytime
    },
});

logger.log({ 'message': 'Hello.', 'logLevel': 'info' });
logger.log({ 'message': 'Hello.', 'logLevel': 'warn' });
logger.log({ 'message': 'Hello.', 'logLevel': 'error' });
logger.log({ 'message': 'Hello.', 'logLevel': 'success' });
1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago