• Create a component logger that will prefix any log messages with the passed string.

    Parameters

    • prefix: string

    Returns ComponentLogger

    Example

    import { prefixLogger } from '@libp2p/logger'

    const logger = prefixLogger('my-node')

    const log = logger.forComponent('my-component')
    log.info('hello world')
    // logs "my-node:my-component hello world"