##Using graphite tags
I suggest use of tags like: appname, environment, host, eventtype
So we can search them
| * { | |
| font-size: 12pt; | |
| font-family: monospace; | |
| font-weight: normal; | |
| font-style: normal; | |
| text-decoration: none; | |
| color: black; | |
| cursor: default; | |
| } |
| var Q = require('q'); | |
| var debug = require('debug')('test'); | |
| var func1 = function() { | |
| return Q.promise(function(resolve, reject) { | |
| setTimeout(function() { | |
| debug('concurrent func1?'); | |
| resolve(1); | |
| }, 4000); | |
| }); |
| //somewhat reusable module socketlogger - it requires the usage of global.socket | |
| //so it's not passed to every log function. | |
| function SocketLogger() {} | |
| var getLogger = function(categoryName) { | |
| SocketLogger.prototype = log4js.getLogger(categoryName); | |
| ['Trace','Debug','Info','Warn','Error','Fatal', 'Mark'].forEach( | |
| function (levelString) { | |
| var level = log4js.levels.toLevel(levelString); |
| var Q = require('q'); | |
| var myarr = [1,2,3,4,5]; | |
| Q.resolve(myarr).then(function (results) { | |
| return results.reduce(function (prev, current) { | |
| console.log(prev, current); | |
| return prev + current; | |
| }) | |
| }).then(function (sum) { |
| var RiotControl = { | |
| _stores: [], | |
| addStore: function(store) { | |
| this._stores.push(store); | |
| } | |
| }; | |
| ['on','one','off','trigger'].forEach(function(api){ | |
| RiotControl[api] = function() { | |
| var args = [].slice.call(arguments); |
| var onedep = require('one'); | |
| var self; | |
| function AsClass(param) { | |
| this.param = param; | |
| } | |
| AsClass.prototype.doSomething(param) { | |
| console.log('can access',self.param); | |
| onedep('whatever', function() { |
| hardstatus alwayslastline | |
| hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]' |
| var config = { | |
| log: {fileinfo: {level: 'INFO', filename: 'whitelabel'}, console: {level: 'DEBUG'}, name: 'whitelabel'}, | |
| seneca: {level: 'INFO'} | |
| } | |
| var bunyan = require('bunyan-loader')(config) //setup bunyan | |
| bunyan.info('Using node', process.version) | |
| var seneca = require('seneca') | |
| var logger = bunyan.child({scope: 'seneca'}) | |
| seneca = seneca({ | |
| log: { |