A JS logging client meant to be used with Woodpecker.
npm install @helios-interactive/crow --save
var crow = require("@helios-interactive/crow");
crow.setUrl("<url of woodpecker>");
crow.setApplication("<application name>");
crow.warn("A message to be logged to woodpecker")<script src="./dist/crow.min.js"></script>
<script>
crow.setUrl("<url of woodpecker>");
crow.setApplication("<application name>");
crow.warn("A message to be logged to woodpecker")
</script>define(['crow'], function (crow) {
crow.setUrl("<url of woodpecker>");
crow.setApplication("<application name>");
crow.warn("A message to be logged to woodpecker")
});import { crow } from '@helios-interactive/crow';
crow.setUrl("<url of woodpecker>");
crow.setApplication("<application name>");
crow.warn("A message to be logged to woodpecker")Crow can be used directly as a logger instance, or create additional loggers. This is useful if we intend to log to multiple applications or Woodpecker instance.
var logger = crow.createLogger();
logger.setUrl("<url of woodpecker>");
logger.setApplication("<application name>");
logger.warn("A message to be logged to woodpecker")creates a new crow logger instance. You can pass in configurations as parameter.
var logger = crow.createLogger()var loggerWithConfig = crow.createLogger({url: "http://localhost:4000", application: "FooBar", devMode: true})
configures the logger. options include woodpecker instances' url, and application name.
Sets the url for crow. This should match the url for your woodpecker instance.
url - The url of the woodpecker instance that is being run.
crow.setUrl('http://localhost:4000')
Sets the application for crow. This will determine what logfile the requests go to.
application - The name of the current application.
crow.setApplication('Foobar')
Sets crow into dev mode. When in dev mode crow will not attempt to log to woodpecker, and will instead only log to console. This can be used in development, but should not be used in production.
devMode - Boolean - true will set crow to devMode. false will set crow back to normal so that it logs to woodpecker. By default crow is not in devMode.
crow.setDevMode(true)
Sends an INFO log to woodpecker
Accepts arguments in the same manner as console.log.
data - Any
...args - Any
crow.info('An info log message.')
crow.info('An info log message.', 'with multiple arguments')
crow.info('An info log message.', 'with multiple arguments', ['of', 'different', 'types'])
Sends an INFO log to woodpecker. Alias of crow.info
Accepts arguments in the same manner as console.log.
data - Any
...args - Any
crow.log('An info log message.')
crow.log('An info log message.', 'with multiple arguments')
crow.log('An info log message.', 'with multiple arguments', ['of', 'different', 'types'])
Sends an DEBUG log to woodpecker
Accepts arguments in the same manner as console.log.
data - Any
...args - Any
crow.debug('An debug log message.')
crow.debug('An debug log message.', 'with multiple arguments')
crow.debug('An debug log message.', 'with multiple arguments', ['of', 'different', 'types'])
Sends an WARN log to woodpecker
Accepts arguments in the same manner as console.log.
data - Any
...args - Any
crow.warn('An warn log message.')
crow.warn('An warn log message.', 'with multiple arguments')
crow.warn('An warn log message.', 'with multiple arguments', ['of', 'different', 'types'])
Sends an ERROR log to woodpecker
Accepts arguments in the same manner as console.log.
data - Any ...args - Any
crow.error('An error log message.')
crow.error('An error log message.', 'with multiple arguments')
crow.error('An error log message.', 'with multiple arguments', ['of', 'different', 'types'])
Sends an FATAL log to woodpecker
Accepts arguments in the same manner as console.log.
data - Any ...args - Any
crow.fatal('An fatal log message.')
crow.fatal('An fatal log message.', 'with multiple arguments')
crow.fatal('An fatal log message.', 'with multiple arguments', ['of', 'different', 'types'])
Property that allows setting a callback function to call whenever crow receives a successful response from Woodpecker
data - Object containing
statusCode,statusMessage,uri, andbodysent with request
crow.onSuccess = function(data){console.log(data)};
Property that allows setting a callback function to call whenever crow throws an error when attempting to make a request to Woodpecker
err - error object with err.message including attempted payload message
crow.onFailure = function(err){console.error(err); console.log(err.message);};