Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
 - Codebase fixes
  • Loading branch information
dr-dimitru committed May 20, 2016
1 parent b2dee74 commit 406a189
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .versions
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
ostrio:[email protected].1
ostrio:[email protected].2
[email protected]
[email protected]
[email protected]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016, dr.dimitru (Veliov Group LLC.)
Copyright (c) 2016, dr.dimitru (Dmitriy A.; Veliov Group, LLC)
All rights reserved.

Redistribution and use in source and binary forms,
Expand Down
78 changes: 44 additions & 34 deletions logger.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ class Logger
_log: (level, message, data = {}, user) =>
uid = user or @userId.get()
for i, em of @_emitters
if @_rules[em.name] and @_rules[em.name].allow.indexOf('*') isnt -1 or @_rules[em.name] and @_rules[em.name].allow.indexOf(level) isnt -1
if @_rules?[em.name] and @_rules[em.name].enable is true
if @_rules[em.name].allow.indexOf('*') isnt -1 or @_rules[em.name] and @_rules[em.name].allow.indexOf(level) isnt -1
if level is "TRACE"
if _.isString data
_data = data
data = {data: _data}
data.stackTrace = @_getStackTrace()

if level is "TRACE"
if _.isString data
_data = data
data = {data: _data}
data.stackTrace = @_getStackTrace()

if Meteor.isClient and em.denyClient is true
Meteor.call em.method, level, message, data, uid
else if @_rules[em.name].client is true and @_rules[em.name].server is true and em.denyClient is false
em.emitter level, message, data, uid
if Meteor.isClient
if Meteor.isClient and em.denyClient is true
Meteor.call em.method, level, message, data, uid
else if @_rules[em.name].client is true and @_rules[em.name].server is true and em.denyClient is false
em.emitter level, message, data, uid
if Meteor.isClient
Meteor.call em.method, level, message, data, uid
else if Meteor.isClient and @_rules[em.name].client is false and @_rules[em.name].server is true
Meteor.call em.method, level, message, data, uid
else if Meteor.isClient and @_rules[em.name].client is false and @_rules[em.name].server is true
Meteor.call em.method, level, message, data, uid
else
em.emitter level, message, data, uid

else
em.emitter level, message, data, uid

return new @_message
level: level
error: level
Expand Down Expand Up @@ -73,29 +73,39 @@ class Logger
@memberOf Logger
@name rule
@param name {String} - Adapter name
@param options {Object} - Settings object, accepts next properties:
enable {Boolean} - Enable/disable adapter
filter {Array} - Array of strings, accepts:
'ERROR', 'FATAL', 'WARN', 'DEBUG', 'INFO', 'TRACE', 'LOG' and '*'
in lowercase or uppercase
default: ['*'] - Accept all
client {Boolean} - Allow execution on Client
server {Boolean} - Allow execution on Server
@param options {Object} - Settings object
options.enable {Boolean} - Enable/disable adapter
options.filter {Array} - Array of strings, accepts:
'ERROR', 'FATAL', 'WARN', 'DEBUG', 'INFO', 'TRACE', 'LOG' and '*'
in lowercase or uppercase
default: ['*'] - Accept all
options.client {Boolean} - Allow execution on Client
options.server {Boolean} - Allow execution on Server
@summary Enable/disable adapter and set it's settings
###
rule: (name, options) =>
if !name or !options or !options.enable
throw new Meteor.Error '500', '"name", "options" and "options.enable" is require on Logger.rule(), when creating rule for "' + name + '"'
check name, String
check options, {
enable: Boolean
client: Match.Optional Boolean
server: Match.Optional Boolean
filter: Match.Optional [String]
}

if options.filter
for rule in options.filter
rule = rule.toUpperCase()

if options.allow
for k of options.allow
options.allow[k] = options.allow[k].toUpperCase()
options.filter ?= ['*']
options.client ?= false
options.server ?= true
options.enable ?= true

@_rules[name] =
@_rules[name] =
enable: options.enable
allow: if options.allow || options.filter then options.allow || options.filter else ['*']
client: if options.client then options.client else false
server: if options.server then options.server else true
allow: options.filter
client: options.client
server: options.server
return

###
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'ostrio:logger',
version: '1.1.1',
version: '1.1.2',
summary: 'Logging: isomorphic driver with support of MongoDB, File (FS) and Console',
git: 'https://github.com/VeliovGroup/Meteor-logger',
documentation: 'README.md'
Expand Down

0 comments on commit 406a189

Please sign in to comment.