@one-view/logger
v0.0.4
Published
## Usage
Downloads
44
Maintainers
Keywords
Readme
@one-view/logger
Usage
Wrap the provider around your app and pass it your build environment (e.g. "DEVELOPMENT", "PRODUCTION")
import { LoggerProvider } from '@one-view/logger';
const App = () => (
<LoggerProvider env={process.env.YOUR_ENV}>
<Main />
</LoggerProvider>
);
You then have access to the logger class inside your components
import { LoggerContext } from '@one-view/logger';
const MyComponent = () => {
const { logger } = React.useContext(LoggerContext);
logger.log('It works!');
// ...
};