提交 c407e82075e2510c51eadd3222cb98c575dad314
1 个父辈
8a73c453
Removed mongoose versioning, added basics of hipchat logger (TODO)
正在显示
3 个修改的文件
包含
15 行增加
和
12 行删除
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | var mergeDefaults = require('merge-defaults') | 4 | var mergeDefaults = require('merge-defaults') |
5 | var winston = require('winston') | 5 | var winston = require('winston') |
6 | var winstonMongoDB = require('winston-mongodb') | 6 | var winstonMongoDB = require('winston-mongodb') |
7 | +var winstonHipchat = require('winston-hipchat') | ||
7 | 8 | ||
8 | exports = module.exports = function(settings) { | 9 | exports = module.exports = function(settings) { |
9 | 10 | ||
@@ -36,6 +37,19 @@ exports = module.exports = function(settings) { | @@ -36,6 +37,19 @@ exports = module.exports = function(settings) { | ||
36 | ) | 37 | ) |
37 | ) | 38 | ) |
38 | 39 | ||
40 | + // TODO: finish this | ||
41 | + /* | ||
42 | + if (settings.logger.hipchat) | ||
43 | + transports.push( | ||
44 | + new winstonMongoDB.MongoDB( | ||
45 | + mergeDefaults( | ||
46 | + settings.output, | ||
47 | + settings.mongo | ||
48 | + ) | ||
49 | + ) | ||
50 | + ) | ||
51 | + */ | ||
52 | + | ||
39 | var logger = new winston.Logger({ | 53 | var logger = new winston.Logger({ |
40 | transports: transports | 54 | transports: transports |
41 | }) | 55 | }) |
@@ -15,11 +15,6 @@ exports = module.exports = function(settings) { | @@ -15,11 +15,6 @@ exports = module.exports = function(settings) { | ||
15 | created_at: Date | 15 | created_at: Date |
16 | }) | 16 | }) |
17 | 17 | ||
18 | - if (settings.mongooseVersioning) | ||
19 | - Schema.add({ | ||
20 | - __versions: [] | ||
21 | - }) | ||
22 | - | ||
23 | Schema.pre('save', function(next) { | 18 | Schema.pre('save', function(next) { |
24 | 19 | ||
25 | var that = this | 20 | var that = this |
@@ -29,13 +24,6 @@ exports = module.exports = function(settings) { | @@ -29,13 +24,6 @@ exports = module.exports = function(settings) { | ||
29 | if (!that.created_at) | 24 | if (!that.created_at) |
30 | that.created_at = that._id.getTimestamp() | 25 | that.created_at = that._id.getTimestamp() |
31 | 26 | ||
32 | - // version history (alternative to `mongoose-version` and `mongoose-history`) | ||
33 | - if (settings.mongooseVersioning) { | ||
34 | - var version = that.toObject() | ||
35 | - version.__v = _.isNumber(version.__v) ? version.__v + 1 : 0 | ||
36 | - delete version.__versions | ||
37 | - that.__versions.push(version) | ||
38 | - } | ||
39 | next() | 27 | next() |
40 | }) | 28 | }) |
41 | 29 |
@@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
29 | "underscore": "~1.6.0", | 29 | "underscore": "~1.6.0", |
30 | "update-notifier": "git://github.com/niftylettuce/update-notifier", | 30 | "update-notifier": "git://github.com/niftylettuce/update-notifier", |
31 | "winston": "git://github.com/niftylettuce/winston", | 31 | "winston": "git://github.com/niftylettuce/winston", |
32 | + "winston-hipchat": "^0.1.1", | ||
32 | "winston-mongodb": "~0.4.3" | 33 | "winston-mongodb": "~0.4.3" |
33 | } | 34 | } |
34 | } | 35 | } |
请
注册
或
登录
后发表评论