@degordian/loggyslav
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    loggyslav Build Status

    What can loggyslav do for you?

    • Make your Typescript/Javascript logging easier
    • Prevent you from writing console.log all over the code
    • Force you to write better code by encouraging you to write smaller methods and classes so you can easily log them
    • Give you a great tool with smart logging which enables you to easily trace and resolve possible bugs

    Tell me more

    Loggyslav is an npm module which easily attaches to any class, method or property and watches for any call or change.

    When attached to a method it can easily track every time it is called. It can log input parameters and return value.

    When attached to a property it can easily track every time it is updated.

    Usage

    Using simple console log as a Method logging

    const simpleMethodLoggyslav = new SimpleMethodLoggyslav();
    const targetsConfiguration: TargetsConfiguration = {
        targets: [
            {
                classType: SimpleClass,
                properties: ["a"],
            },
        ],
    };
    const loggerConfiguration = {
        methodLogger: simpleMethodLoggyslav,
    };
    const loggyslav = new Loggyslav(targetsConfiguration, loggerConfiguration);

    Using Winston.js as Method logger

    const winstonNewLogger = new winston.Logger( {
        level: "info",
        transports: [
            new winston.transports.Console(),
        ],
    } );
    const winstonLogger = new WinstonLoggyslav(winstonNewLogger);
    const targetsConfiguration: TargetsConfiguration = {
        targets: [
            {
                classType: SimpleClass,
            },
        ],
    };
    const loggerConfiguration: targetsConfiguration = {
        methodLogger: winstonLogger,
    };
    
    const loggyslav = new Loggyslav(
        targetsConfiguration,
        loggerConfiguration,
    );

    Using Winston.js as Error logger

    const winstonNewLogger = new winston.Logger( {
        level: "error",
        transports: [
            new winston.transports.Console(),
        ],
    } );
    const winstonLogger = new WinstonLoggyslav(winstonNewLogger);
    const winstonErrorLogger = new WinstonErrorLoggyslav(winstonNewErrorLogger);
    
    const targetsConfiguration: TargetsConfiguration = {
        targets: [
            {
                classType: SimpleClass,
            },
        ],
    };
    const loggerConfiguration: LoggerConfiguration = {
        methodLogger: winstonLogger,
        errorLogger: winstonErrorLogger,
    };
    
    const loggyslav = new Loggyslav(
        targetsConfiguration,
        loggerConfiguration,
    );

    Features

    • [x] Method input and output logging
    • [x] Property change logging
    • [x] Error logging
    • [ ] Creating easy benchmark tracking
    • [ ] Track memory consumtion

    Development

    Want to contribute? Great!

    loggyslav is written with Typescript which builds automatically on npm publish. Behind every PR review is Travis the guardian.

    Build Typescript:

    npm run build
    

    Test your code:

    npm test
    

    Check your code style:

    npm run tslint
    

    Install

    npm i @degordian/loggyslav

    DownloadsWeekly Downloads

    1

    Version

    1.1.0

    License

    ISC

    Unpacked Size

    130 kB

    Total Files

    114

    Last publish

    Collaborators

    • jakagacic
    • dvorsky
    • degordian-dev
    • renatoruk
    • ilesar
    • kru