lib/anomaly.js
function getBody(id, arr) {
	var result = []

	// heading and location: 'Anomaly 2012-08-11T03:23:49.725Z'
	var now = new Date
	result.push('Anomaly ' + now.toISOString() + ' ' + haraldutil.getISOPacific(now))
	if (id) result.push()
	result.push('host:' + os.hostname() +
		' app:' + (opts.app || 'unknown') +
		' api: ' + (id || 'unknown')) +
		' pid: ' + process.pid

	// output each provided argument
	arr.forEach(function (value, index) {
		result.push((index + 1) + ': ' + haraldutil.inspectDeep(value))
	})

	// a stack trace for the invocation of anomaly
	var o = haraldutil.parseTrace(new Error)
	if (o && Array.isArray(o.frames)) {
		result.push('Anomaly invoked from:')
		for (var ix = 2; ix < o.frames.length; ix++) {
			var frame = o.frames[ix]
			var s = [' ']
			if (frame.func) s.push(frame.func)
			if (frame.as) s.push('as:', frame.as)
			if (frame.file) s.push(frame.file + ':' + frame.line + ':' + frame.column)
			if (frame.folder) s.push(frame.folder)
			if (frame.source) s.push('source:', frame.source)
			result.push(s.join(' '))
		}
	}

	return result.join('\n')
}
function getBody(id, arr) {
	var result = []

	// heading and location: 'Anomaly 2012-08-11T03:23:49.725Z'
	var now = new Date
	result.push('Anomaly ' + now.toISOString() + ' ' + haraldutil.getISOPacific(now))
	if (id) result.push()
	result.push('host:' + os.hostname() +
		' app:' + (opts.app || 'unknown') +
		' api: ' + (id || 'unknown')) +
		' pid: ' + process.pid

	// output each provided argument
	arr.forEach(function (value, index) {
		result.push((index + 1) + ': ' + haraldutil.inspectDeep(value))
	})

	// a stack trace for the invocation of anomaly
	var o = haraldutil.parseTrace(new Error)
	if (o && Array.isArray(o.frames)) {
		result.push('Anomaly invoked from:')
		for (var ix = 2; ix < o.frames.length; ix++) {
			var frame = o.frames[ix]
			var s = [' ']
			if (frame.func) s.push(frame.func)
			if (frame.as) s.push('as:', frame.as)
			if (frame.file) s.push(frame.file + ':' + frame.line + ':' + frame.column)
			if (frame.folder) s.push(frame.folder)
			if (frame.source) s.push('source:', frame.source)
			result.push(s.join(' '))
		}
	}

	return result.join('\n')
}
function getBody ( id , arr ) { var result = [ ] // heading and location: 'Anomaly 2012-08-11T03:23:49.725Z' var now = new Date result . push ( 'Anomaly ' + now . toISOString ( ) + ' ' + haraldutil . getISOPacific ( now ) ) if ( id ) result . push ( ) result . push ( 'host:' + os . hostname ( ) + ' app:' + ( opts . app || 'unknown' ) + ' api: ' + ( id || 'unknown' ) ) + ' pid: ' + process . pid // output each provided argument arr . forEach ( function ( value , index ) { result . push ( ( index + 1 ) + ': ' + haraldutil . inspectDeep ( value ) ) } ) // a stack trace for the invocation of anomaly var o = haraldutil . parseTrace ( new Error ) if ( o && Array . isArray ( o . frames ) ) { result . push ( 'Anomaly invoked from:' ) for ( var ix = 2 ; ix < o . frames . length ; ix ++ ) { var frame = o . frames [ ix ] var s = [ ' ' ] if ( frame . func ) s . push ( frame . func ) if ( frame . as ) s . push ( 'as:' , frame . as ) if ( frame . file ) s . push ( frame . file + ':' + frame . line + ':' + frame . column ) if ( frame . folder ) s . push ( frame . folder ) if ( frame . source ) s . push ( 'source:' , frame . source ) result . push ( s . join ( ' ' ) ) } } return result . join ( '\n' ) }
assemble the text body of one anomaly
assemble the text body of one anomaly