Socket
Book a DemoInstallSign in
Socket

@ao-framework/logger

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ao-framework/logger

The logger is an abstract class that allows you to create custom loggers where you can define a specific implementation without having to worry about specific methods commonly used in the practice of logging information in applications.

0.0.3
latest
npmnpm
Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source


Logger

The logger is an abstract class that allows you to create custom loggers where you can define the functionality implementation without having to worry about implementing commonly used methods in the practice of logging information. It provides for both sync and async functionality.

Import the library

import Logger from "@ao-framework/logger";

Create a Logger

export class MyLogger extends Logger {

    protected async implementation(level: string, message: string) {
        //do something with your message
    }

    protected implementationSync(level: string, message: string) {
        //do something with your message
    }

}

export default new MyLogger();

Use it

import mylogger from "./loggers/mylogger"

//either below will work
mylogger.info(`This is a log message for ${user.name}`)
mylogger.info("This is a log message for ${user.name}", user)

Available Methods

logger.emergency(message: string, context?: object) => Promise<any> 
//or
logger.emergencySync(message: string, context?: object) => any 
logger.alert(message: string, context?: object) => Promise<any>
//or 
logger.alertSync(message: string, context?: object) => any 
logger.critical(message: string, context?: object) => Promise<any> 
//or
logger.criticalSync(message: string, context?: object) => any
logger.error(message: string, context?: object) => Promise<any> 
//or
logger.errorSync(message: string, context?: object) => any 
logger.warning(message: string, context?: object) => Promise<any> 
//or
logger.warningSync(message: string, context?: object) => any 
logger.notice(message: string, context?: object) => Promise<any> 
//or
logger.noticeSync(message: string, context?: object) => any 
logger.info(message: string, context?: object) => Promise<any> 
//or
logger.infoSync(message: string, context?: object) => any 
logger.debug(message: string, context?: object) => Promise<any> 
//or
logger.debugSync(message: string, context?: object) => any 
logger.log(level: string, message: string, context?: object) => Promise<any> 
//or
logger.logSync(level: string, message: string, context?: object) => any 

FAQs

Package last updated on 11 Mar 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.