Sha256: dae9948cbe43b1946b7e156c2832d4b2fe7911606b7228d90ee1e93d0114b885
Contents?: true
Size: 1.2 KB
Versions: 29
Compression:
Stored size: 1.2 KB
Contents
require 'ansi' module Nutella module App module Log def self.debug(message, code=nil) puts( ANSI.cyan + message + ANSI.reset ) Nutella.app.net.publish( 'logging', log_to_json(message, code, __method__) ) code end def self.info(message, code=nil) puts( message ) Nutella.app.net.publish( 'logging', log_to_json(message, code, __method__) ) code end def self.success(message, code=nil) puts( ANSI.green + message + ANSI.reset ) Nutella.app.net.publish( 'logging', log_to_json(message, code, __method__) ) code end def self.warn(message, code=nil) puts( ANSI.yellow + message + ANSI.reset ) Nutella.app.net.publish( 'logging', log_to_json(message, code, __method__) ) code end def self.error(message, code=nil) puts( ANSI.red + message + ANSI.reset ) Nutella.app.net.publish( 'logging', log_to_json(message, code, __method__) ) code end private def self.log_to_json( message, code, level) code.nil? ? {level: level, message: message} : {level: level, message: message, code: code} end end end end
Version data entries
29 entries across 29 versions & 1 rubygems