import { config } from "aws-sdk" ; import { version } from "../package.json" ; param line internal export function debug ( line ) { if ( isLoggerSet ( ) ) { _prepend ( line , "DEBUG" ) ; } } param line internal export function error ( line ) { if ( isLoggerSet ( ) ) { _prepend ( line , "ERROR" ) ; } } param line internal export function info ( line ) { if ( isLoggerSet ( ) ) { _prepend ( line , "INFO" ) ; } } returns function isLoggerSet ( ) { return config . logger !== null ; } param line internal export function log ( line ) { if ( isLoggerSet ( ) ) { _prepend ( line , "LOG" ) ; } } param line internal export function warn ( line ) { if ( isLoggerSet ( ) ) { _prepend ( line , "WARN" ) ; } } param line param level function _prepend ( line , level ) { if ( config . logger ) { if ( typeof config . logger . log === "function" ) { config . logger . log ( `[${ level }][Javascript QLDB Driver, Version: ${ version }] ${ line }` ) ; } else if ( typeof config . logger . write === "function" ) { config . logger . write ( `[${ level }][Javascript QLDB Driver, Version: ${ version }] ${ line }\n` ) ; } } }