Options
Menu

@s3-publish/loggers Module

Index

Constructor Options Type aliases

LoggerOptions

LoggerOptions: { onLog?: LogMessageHandler; showErrorStack?: undefined | false | true; showHashes?: undefined | false | true; showIgnored?: undefined | false | true; showParams?: undefined | false | true; showSkipped?: undefined | false | true; stream?: Writable | null }

Type declaration

  • Optional onLog?: LogMessageHandler

    If defined, this function is called for each log message

    default

    undefined

  • Optional showErrorStack?: undefined | false | true

    Show Error stacktrace

    default

    false

  • Optional showHashes?: undefined | false | true

    Show File ETag property

    default

    false

  • Optional showIgnored?: undefined | false | true

    Show ignored files (both in origin and target)

    default

    false

  • Optional showParams?: undefined | false | true

    Show request parameters

    default

    false

  • Optional showSkipped?: undefined | false | true

    Show skipped (unchanged/unexpected) files

    default

    false

  • Optional stream?: Writable | null
    see

    Writable

    default

    process.stdout

    remarks

    If null, nothing will be output

Message Type aliases

LogMessage

MessageError

MessageError: { error: Error; type: "error" }

Type declaration

  • error: Error
  • type: "error"

MessageInitResult

MessageInitResult: { type: "init:result"; wrote?: undefined | string }

Type declaration

  • type: "init:result"
  • Optional wrote?: undefined | string

    Path to output file (undefined if output to stdout)

MessageLsBegin

MessageLsBegin: { provider: LoggableProvider; type: "ls:begin" }

Type declaration

MessageLsResult

MessageLsResult: { duration: number; files: LoggableFileMap; ignored: FileIgnored[]; ignoredCount: number; provider: LoggableProvider; type: "ls:result" }

Type declaration

MessageSyncOperationBegin

MessageSyncOperationBegin: { operation: LoggableOperation; type: "sync:operation:begin" }

Type declaration

MessageSyncOperationResult

MessageSyncOperationResult: { duration: number; operation: LoggableOperation; type: "sync:operation:result" }

Type declaration

  • duration: number

    Time elapsed during operation (in ms)

  • operation: LoggableOperation
  • type: "sync:operation:result"

MessageSyncPlanBegin

MessageSyncPlanBegin: { type: "sync:plan:begin" }

Type declaration

  • type: "sync:plan:begin"

MessageSyncPlanResult

MessageSyncPlanResult: { ignored: Record<string, FileIgnored[]>; ignoredCount: number; operations: LoggableOperation[]; skipped: FileSkipped[]; skippedCount: number; type: "sync:plan:result" }

Type declaration

MessageSyncResult

MessageSyncResult: { duration: number; type: "sync:result" }

Type declaration

  • duration: number

    Time elapsed during all operations (in ms)

  • type: "sync:result"

MessageVersion

MessageVersion: { packageVersions: Record<string, string>; type: "version" }

Type declaration

  • packageVersions: Record<string, string>
  • type: "version"

Other Type aliases

FileIgnored

FileIgnored: { file: LoggableFile; type: "ignore" }

Type declaration

FileSkipped

FileSkipped: { file: LoggableFile; reason: Reason; targetFile?: LoggableFile; type: "skip" }

Type declaration

FileSource

FileSource: { file: KeySource }

Type declaration

KeySource

KeySource: { Key?: undefined | string }

Type declaration

  • Optional Key?: undefined | string

LogMessageHandler

LogMessageHandler: (message: LogMessage) => void

Type declaration

LoggableFile

LoggableFile: Omit<File, "SourceProvider"> & { SourceProvider: LoggableProvider }

LoggableFileMap

LoggableFileMap: Map<string, LoggableFile>

LoggableOperation

LoggableOperation: Omit<ProviderOperation, "file"> & { file: LoggableFile }

LoggableProvider

LoggableProvider: Pick<Provider, "root">

LoggerOptionsWithMode

LoggerOptionsWithMode: LoggerOptions & { mode: "json" | "text" }

Other Functions

compareFileKeys

compareKeys

formatDate

  • formatDate(date?: Date): string | undefined
    • If date is falsy, returns undefined
    • If process.env.PORCELAIN is set, returns date represented in UTC formatted as ISO 8601
    • Otherwise, returns date represented in local time formatted using process.env.DATE_FORMAT (which defaults to "yyyy-mm-dd HH:MM:ss")
    see

    DATE_FORMAT mask options

    remarks

    This is a thin wrapper around dateformat

    Parameters

    • Optional date: Date

    Returns string | undefined

formatDuration

  • formatDuration(milliseconds?: number): string | number
    • If process.env.PORCELAIN is set, returns milliseconds unchanged
    • Otherwise, returns a human readable string (ex. "15d 11h 23m 20s")
    remarks

    This is a thin wrapper around pretty-ms

    Parameters

    • Default value milliseconds: number = 0

    Returns string | number

formatDurationAsString

  • formatDurationAsString(milliseconds?: number): string

formatRoot

  • formatRoot(root: string): string

formatSize

  • formatSize(sizeInBytes?: number): string | number
    • If process.env.PORCELAIN is set, returns sizeInBytes unchanged
    • Otherwise, returns a human readable string (ex. "42 KB")
    remarks

    This is a thin wrapper around filesize

    Parameters

    • Default value sizeInBytes: number = 0

    Returns string | number

formatSizeAsString

  • formatSizeAsString(sizeInBytes?: number): string

View Functions

lsResultText

syncPlanResultText

Generated using TypeDoc