@penpad/plugin-logger
Logger plugin for Penpad
Last updated a year ago by rstacruz .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @penpad/plugin-logger 
SYNC missed versions from official npm registry.

@penpad/plugin-logger

Logger plugin for Penpad

Usage

Add <LoggerPlugin /> to your Penpad component.

import { LoggerPlugin } from '@penpad/plugin-logger'
<Penpad>
  <LoggerPlugin />

  {/* other Penpad definitioms here */}
</Penpad>

Logging entries

Use the useLogger() React hook to return a logging function.

import { useLogger } from '@penpad/plugin-logger'

const YourComponent = () => {
  const log = useLogger()

  return (
    <button
      onClick={() => {
        log('Clicked!')
      }}
    >
      Click me!
    </button>
  )
}

Logging entries in class components

There is also a <UseLogger> render prop component.

import { UseLogger } from '@penpad/plugin-logger'
<UseLogger>
  {({ log }) => (
    <Specimen id='Another specimen'>
      <button
        onClick={() => {
          log('Hello, I was clicked on ' + new Date().toString())
        }}
      >
        Click me
      </button>
    </Specimen>
  )}
</UseLogger>

Current Tags

  • 0.4.0-alpha.0                                ...           latest (a year ago)

3 Versions

  • 0.4.0-alpha.0                                ...           a year ago
  • 0.3.0-alpha.0                                ...           2 years ago
  • 0.2.0-alpha.5                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |