Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: npm/proc-log
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.1.0
Choose a base ref
...
head repository: npm/proc-log
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.2.0
Choose a head ref
  • 3 commits
  • 8 files changed
  • 2 contributors

Commits on Apr 16, 2024

  1. feat: add META symbol to exports (#84)

    Two things to note:
    
    - The key is the string `'META'`
    - The value is `Symbol('proc-log.meta')`
    
    So it could be used like the following. All of the following is up to
    producers/consumers to implement with shared conventions. All `proc-log`
    is doing to allowing them to share a unique `Symbol`.
    
    ```js
    const { output, META } = require('../')
    
    // An example of how consumers would see if a META object
    // was the last argument from an event
    const getMeta = (args) => {
      let meta = {}
      const last = args.at(-1)
      if (last && typeof last === 'object' && Object.hasOwn(last, META)) {
        meta = args.pop()
      }
      return [meta, ...args]
    }
    
    process.on('output', (level, ...rawArgs) => {
      const [{ force = false }, ...args] = getMeta(rawArgs)
      console.log(level, { force, args })
    })
    
    // in this implementation the value does not matter, just the key
    output.standard('arg1', 'arg2', { [META]: null, force: true })
    output.standard('arg1', 'arg2')
    output.standard('arg1', null)
    output.standard(null)
    output.standard()
    
    // Will log the following:
    // standard { force: true, args: [ 'arg1', 'arg2' ] }
    // standard { force: false, args: [ 'arg1', 'arg2' ] }
    // standard { force: false, args: [ 'arg1', null ] }
    // standard { force: false, args: [ null ] }
    // standard { force: false, args: [] }
    ```
    
    Closes: #81
    lukekarrys authored Apr 16, 2024
    Configuration menu
    Copy the full SHA
    66b7da7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4c0d3cf View commit details
    Browse the repository at this point in the history
  3. chore: release 4.2.0 (#86)

    🤖 I have created a release *beep* *boop*
    ---
    
    
    ## [4.2.0](v4.1.0...v4.2.0)
    (2024-04-16)
    
    ### Features
    
    *
    [`4c0d3cf`](4c0d3cf)
    [#85](#85) add flush method to
    output (#85) (@lukekarrys)
    
    ---
    This PR was generated with [Release
    Please](https://github.com/googleapis/release-please). See
    [documentation](https://github.com/googleapis/release-please#release-please).
    
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Apr 16, 2024
    Configuration menu
    Copy the full SHA
    953e603 View commit details
    Browse the repository at this point in the history
Loading