Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
 - Codebase enhancements and fixes
 - Dependencies update
 - Docs update
  • Loading branch information
dr-dimitru committed May 20, 2016
1 parent 4e2ab49 commit d813fff
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 34 deletions.
36 changes: 18 additions & 18 deletions .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .versions
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ [email protected]
[email protected]
[email protected]
[email protected]
ostrio:[email protected].1
ostrio:[email protected].1
ostrio:[email protected].2
ostrio:[email protected].2
ostrio:[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
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,22 @@ Usage
- `data` {*Object*}
- `userId` {*String*} - set if user is logged in and package `accounts-base` is installed
- Note: Do not forget `\r\n` at the end of record-line
- `path` {*String*} - Log's storage path, absolute, or relative to NodeJS process, note: do not use '~' (path relative to user)!
- `options.path` {*String*} - Log's storage path, absolute, or relative to NodeJS process, note: do not use '~' (path relative to user)!

Example:
```javascript
this.log = new Logger(); // Initialize Logger
// Initialize Logger:
this.log = new Logger();

// Initialize LoggerFile and enable with default settings:
(new LoggerFile(log)).enable();
```

Example 2:
```javascript
// Initialize Logger
this.log = new Logger();

// Initialize LoggerFile:
var LogFile = new LoggerFile(log, {
fileNameFormat: function(time) {
Expand All @@ -51,13 +62,14 @@ var LogFile = new LoggerFile(log, {
path: '/data/logs/' /* Use absolute storage path */
});

LogFile.enable(); // Enable LoggerFile with default settings
// Enable LoggerFile with default settings
LogFile.enable();
```

##### Activate and set adapter settings: [*Isomorphic*]
```javascript
this.log = new Logger();
new LoggerFile(log, {}).enable({
(new LoggerFile(log)).enable({
enable: true,
filter: ['ERROR', 'FATAL', 'WARN'], /* Filters: 'ERROR', 'FATAL', 'WARN', 'DEBUG', 'INFO', 'TRACE', '*' */
client: false, /* This allows to call, but not execute on Client */
Expand All @@ -68,7 +80,7 @@ new LoggerFile(log, {}).enable({
##### Log message: [*Isomorphic*]
```javascript
this.log = new Logger();
new LoggerFile(log).enable();
(new LoggerFile(log)).enable();

/*
message {String} - Any text message
Expand Down Expand Up @@ -105,15 +117,15 @@ window.onerror = function(msg, url, line) {
this.log1 = new Logger();
this.log2 = new Logger();

new LoggerFile(log1).enable();
(new LoggerFile(log1)).enable();

new LoggerFile(log2, {
(new LoggerFile(log2, {
fileNameFormat: function(time) {
return (time.getDate()) + "-" + (time.getMonth() + 1) + "-" + (time.getFullYear()) + "_" + (time.getHours()) + ".log";
},
format: function(time, level, message, data, userId) {
return "[" + level + "] | " + (time.getMinutes()) + ":" + (time.getSeconds()) + " | \"" + message + "\" | User: " + userId + "\r\n";
},
path: '/data/logs/'
}).enable();
})).enable();
```
11 changes: 9 additions & 2 deletions loggerfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if Meteor.isServer
class LoggerFile
constructor: (@logger, @options = {}) ->
check @logger, Match.OneOf Logger, Object
check @options, Object
check @options, Match.Optional Object

self = @
if Meteor.isServer
Expand Down Expand Up @@ -87,9 +87,16 @@ class LoggerFile
, true

enable: (rule = {}) ->
check rule, Object
check rule, {
enable: Match.Optional Boolean
client: Match.Optional Boolean
server: Match.Optional Boolean
filter: Match.Optional [String]
}

rule.enable ?= true
rule.client ?= false
rule.server ?= true

@logger.rule 'File', rule
return @
6 changes: 3 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'ostrio:loggerfile',
version: '1.1.1',
version: '1.1.2',
summary: 'Logging: Store application\'s logs into file (Server & Client support)',
git: 'https://github.com/VeliovGroup/Meteor-logger-file',
documentation: 'README.md'
Expand All @@ -9,11 +9,11 @@ Package.describe({
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use('ostrio:[email protected]', 'server')
api.use(['coffeescript', 'ostrio:[email protected].1', 'check', 'underscore'], ['client', 'server']);
api.use(['coffeescript', 'ostrio:[email protected].2', 'check', 'underscore'], ['client', 'server']);
api.addFiles('loggerfile.coffee', ['client', 'server']);
api.export('LoggerFile');
});

Npm.depends({
'fs-extra': '0.28.0' // NOTE: this package has dropped support for Node v0.10, since v0.29.0
'fs-extra': '0.30.0' // NOTE: this package has dropped support for Node v0.10, since v0.29.0; Brought back Node v0.10 support in v0.30.0, official support will end 2016-10-01
});

0 comments on commit d813fff

Please sign in to comment.