1.0.4 • Published 5 years ago
fragment-fancylogs v1.0.4
FancyLogs
FancyLogs is a library that will allow you to do some... fancy logs like these:
Installation
Use yarn (or npm) to install the package.
yarn add fragment-fancylogs
Usage
import FancyLogs from 'fragment-fancylogs'
const customColors = {
fragment: {
backgroundColor: '#FD6953',
textColor: '#000'
}
}
//The first parameter allows you to add custom log options
//The second parameter enables or disabled the logger
const fancyLogs = new FancyLogs(customColors, process.env.NODE_ENV === 'dev')
fancyLogs.info('just so you now', 'This is very informative')
fancyLogs.success('hell yeah', { hey: 'ho' }, { lets: 'go' })
fancyLogs.warning('well it could get dangerous', { you: 'know' }, { what: 'I mean' })
fancyLogs.error('ups', { we: 'broke it' })
fancyLogs.fragment('custom fragment color', { contact_us: 'https://www.fragment.agency/' })
fancyLogs.setEnabled(false)
fancyLogs.error('no more logs', { we: 'we use this in production' })
If you use traditional JS you can add the script 'dist/FancyLogs.js' to your HTML and use FancyLogs using the same methods as the previous example.
<script src="FancyLogs.js"></script>
const fancyLogs = new FancyLogs.default(customColors)
fancyLogs.info('just so you now', 'This is very informative')
License
FancyLogs is licensed under the MIT License. Developed by Fragment Agency in 2019