How to use the @canopycanopycanopy/b-ber-logger.debug function in @canopycanopycanopy/b-ber-logger

To help you get started, we’ve selected a few @canopycanopycanopy/b-ber-logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github triplecanopy / b-ber / packages / b-ber-grammar-section / src / index.js View on Github external
function openElement(token, fileName, lineNumber) {
  // destructure the attributes from matches, omitting `matches[0]` since
  // we're only interested in the captures
  const [, type, id, attr] = token

  log.debug(`open directive [${id}]`)

  const comment = Html.comment(
    `START: section:${type}#${htmlId(id)}; ${fileName}:${lineNumber}`
  )
  const attrs = attributes(attr, type, { fileName, lineNumber })
  return `${comment}<section id="${htmlId(id)}">`
}
</section>
github triplecanopy / b-ber / packages / b-ber-grammar-section / src / index.js View on Github external
function handleExitDirective(token) {
  const [, type, id] = token

  log.debug(`exit directive [${id}]`)

  const comment = Html.comment(`END: section:${type}#${htmlId(id)}`)
  const directive = find(state.cursor, { id })

  state.remove('cursor', { id })

  if (isGallery(directive)) {
    // prettier-ignore
    return `
                
                
                
                ${comment}`
  }

  if (isSpread(directive)) {
github triplecanopy / b-ber / packages / b-ber-grammar-renderer / src / index.js View on Github external
log.error(
        `Missing [id] for [${exports.default.name}:start] at ${context.fileName}.md:${line}`
      )

      // let the parser know that this wasn't a match
      return false
    }

    // we add the `id` to the global state so that we can verify that the
    // container is being properly closed in our `validateClose` method
    const index = state.indexOf('cursor', { id })
    const isOpening = type && type !== 'exit'
    const isClosing = type && type === 'exit'
    const inStore = index > -1

    log.debug(
      `id: ${id}; isOpening: ${isOpening}; isClosing: ${isClosing}; type: ${type}, inStore: ${inStore}`
    )

    const location = `${context.fileName}.md:${line}`
    if (isOpening && inStore) {
      // it's a duplicate `id`, throw
      log.error(`Duplicate [id] [${id}]. [id] must be unique at [${location}]`)
    } else if (isClosing && !inStore) {
      // trying to close an un-opened directive, but it might belong to a
      // different directive type
      return false
    } else if (isOpening && !inStore) {
      // it's a brand new directive
      state.add('cursor', { id, type })
      return true
    } else if (isClosing && inStore) {

@canopycanopycanopy/b-ber-logger

`b-ber-logger` is b-ber's console logger.

GPL-3.0-or-later
Latest version published 3 months ago

Package Health Score

69 / 100
Full package analysis

Similar packages