Authored by 周奇琪

Merge branch 'feature/influxdb-log' into develop

Conflicts:
	library/api.js
1 -  
2 -# Created by https://www.gitignore.io/api/node,webstorm,netbeans,sublimetext,vim  
3 -  
4 -### Node ###  
5 -# Logs  
6 -logs  
7 -*.log  
8 -npm-debug.log*  
9 -  
10 -# Runtime data  
11 -pids  
12 -*.pid  
13 -*.seed  
14 -  
15 -# Directory for instrumented libs generated by jscoverage/JSCover  
16 -lib-cov  
17 -  
18 -# Coverage directory used by tools like istanbul  
19 -coverage  
20 -  
21 -# nyc test coverage  
22 -.nyc_output  
23 -  
24 -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)  
25 -.grunt  
26 -  
27 -# node-waf configuration  
28 -.lock-wscript  
29 -  
30 -# Compiled binary addons (http://nodejs.org/api/addons.html)  
31 -build/Release  
32 -  
33 -# Dependency directories  
34 -node_modules  
35 -jspm_packages  
36 -  
37 -# Optional npm cache directory  
38 -.npm  
39 -  
40 -# Optional REPL history  
41 -.node_repl_history  
42 -  
43 -  
44 -### WebStorm ###  
45 -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm  
46 -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839  
47 -  
48 -# User-specific stuff:  
49 -.idea/workspace.xml  
50 -.idea/tasks.xml  
51 -.idea/dictionaries  
52 -.idea/vcs.xml  
53 -.idea/jsLibraryMappings.xml  
54 -  
55 -# Sensitive or high-churn files:  
56 -.idea/dataSources.ids  
57 -.idea/dataSources.xml  
58 -.idea/dataSources.local.xml  
59 -.idea/sqlDataSources.xml  
60 -.idea/dynamic.xml  
61 -.idea/uiDesigner.xml  
62 -  
63 -# Gradle:  
64 -.idea/gradle.xml  
65 -.idea/libraries  
66 -  
67 -# Mongo Explorer plugin:  
68 -.idea/mongoSettings.xml  
69 -  
70 -## File-based project format:  
71 -*.iws  
72 -  
73 -## Plugin-specific files:  
74 -  
75 -# IntelliJ  
76 -/out/  
77 -  
78 -# mpeltonen/sbt-idea plugin  
79 -.idea_modules/  
80 -  
81 -# JIRA plugin  
82 -atlassian-ide-plugin.xml  
83 -  
84 -# Crashlytics plugin (for Android Studio and IntelliJ)  
85 -com_crashlytics_export_strings.xml  
86 -crashlytics.properties  
87 -crashlytics-build.properties  
88 -fabric.properties  
89 -  
90 -### WebStorm Patch ###  
91 -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721  
92 -  
93 -# *.iml  
94 -# modules.xml  
95 -  
96 -  
97 -### NetBeans ###  
98 -nbproject/private/  
99 -build/  
100 -nbbuild/  
101 -dist/  
102 -nbdist/  
103 -nbactions.xml  
104 -.nb-gradle/  
105 -  
106 -  
107 -### SublimeText ###  
108 -# cache files for sublime text  
109 -*.tmlanguage.cache  
110 -*.tmPreferences.cache  
111 -*.stTheme.cache  
112 -  
113 -# workspace files are user-specific  
114 -*.sublime-workspace  
115 -  
116 -# project files should be checked into the repository, unless a significant  
117 -# proportion of contributors will probably not be using SublimeText  
118 -# *.sublime-project  
119 -  
120 -# sftp configuration file  
121 -sftp-config.json  
122 -  
123 -  
124 -### Vim ###  
125 -# swap  
126 -[._]*.s[a-w][a-z]  
127 -[._]s[a-w][a-z]  
128 -# session  
129 -Session.vim  
130 -# temporary  
131 -.netrwhist  
132 -*~  
133 -# auto-generated tag files  
134 -tags  
135 -  
136 -### YOHO ###  
137 -dist 1 +
  2 +# Created by https://www.gitignore.io/api/node,webstorm,netbeans,sublimetext,vim
  3 +
  4 +### Node ###
  5 +# Logs
  6 +logs
  7 +*.log
  8 +npm-debug.log*
  9 +
  10 +# Runtime data
  11 +pids
  12 +*.pid
  13 +*.seed
  14 +
  15 +# Directory for instrumented libs generated by jscoverage/JSCover
  16 +lib-cov
  17 +
  18 +# Coverage directory used by tools like istanbul
  19 +coverage
  20 +
  21 +# nyc test coverage
  22 +.nyc_output
  23 +
  24 +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
  25 +.grunt
  26 +
  27 +# node-waf configuration
  28 +.lock-wscript
  29 +
  30 +# Compiled binary addons (http://nodejs.org/api/addons.html)
  31 +build/Release
  32 +
  33 +# Dependency directories
  34 +node_modules
  35 +jspm_packages
  36 +
  37 +# Optional npm cache directory
  38 +.npm
  39 +
  40 +# Optional REPL history
  41 +.node_repl_history
  42 +
  43 +
  44 +### WebStorm ###
  45 +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
  46 +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
  47 +
  48 +# User-specific stuff:
  49 +.idea/workspace.xml
  50 +.idea/tasks.xml
  51 +.idea/dictionaries
  52 +.idea/vcs.xml
  53 +.idea/jsLibraryMappings.xml
  54 +
  55 +# Sensitive or high-churn files:
  56 +.idea/dataSources.ids
  57 +.idea/dataSources.xml
  58 +.idea/dataSources.local.xml
  59 +.idea/sqlDataSources.xml
  60 +.idea/dynamic.xml
  61 +.idea/uiDesigner.xml
  62 +
  63 +# Gradle:
  64 +.idea/gradle.xml
  65 +.idea/libraries
  66 +
  67 +# Mongo Explorer plugin:
  68 +.idea/mongoSettings.xml
  69 +
  70 +## File-based project format:
  71 +*.iws
  72 +
  73 +## Plugin-specific files:
  74 +
  75 +# IntelliJ
  76 +/out/
  77 +
  78 +# mpeltonen/sbt-idea plugin
  79 +.idea_modules/
  80 +
  81 +# JIRA plugin
  82 +atlassian-ide-plugin.xml
  83 +
  84 +# Crashlytics plugin (for Android Studio and IntelliJ)
  85 +com_crashlytics_export_strings.xml
  86 +crashlytics.properties
  87 +crashlytics-build.properties
  88 +fabric.properties
  89 +
  90 +### WebStorm Patch ###
  91 +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
  92 +
  93 +# *.iml
  94 +# modules.xml
  95 +
  96 +
  97 +### NetBeans ###
  98 +nbproject/private/
  99 +build/
  100 +nbbuild/
  101 +dist/
  102 +nbdist/
  103 +nbactions.xml
  104 +.nb-gradle/
  105 +
  106 +
  107 +### SublimeText ###
  108 +# cache files for sublime text
  109 +*.tmlanguage.cache
  110 +*.tmPreferences.cache
  111 +*.stTheme.cache
  112 +
  113 +# workspace files are user-specific
  114 +*.sublime-workspace
  115 +
  116 +# project files should be checked into the repository, unless a significant
  117 +# proportion of contributors will probably not be using SublimeText
  118 +# *.sublime-project
  119 +
  120 +# sftp configuration file
  121 +sftp-config.json
  122 +
  123 +
  124 +### Vim ###
  125 +# swap
  126 +[._]*.s[a-w][a-z]
  127 +[._]s[a-w][a-z]
  128 +# session
  129 +Session.vim
  130 +# temporary
  131 +.netrwhist
  132 +*~
  133 +# auto-generated tag files
  134 +tags
  135 +
  136 +### YOHO ###
  137 +dist
138 public/css/* 138 public/css/*
139 -public/bundle/*  
140 -.eslintcache 139 +public/bundle/*
  140 +.eslintcache
  141 +*.log.*
@@ -7,26 +7,29 @@ @@ -7,26 +7,29 @@
7 7
8 module.exports = { 8 module.exports = {
9 domains: { 9 domains: {
10 - api:'http://192.168.102.202:8088/platform' 10 + api: 'http://192.168.102.202:8088/platform'
11 }, 11 },
12 loggers: { 12 loggers: {
13 - file:{  
14 - level:'info',  
15 - maxsize:100 * 1024 * 1024,  
16 - handleExceptions:true,  
17 - zippedArchive:true,  
18 - timestamp:true,  
19 - filename:'info.log' 13 + infoFile: {
  14 + name: 'info',
  15 + level: 'info',
  16 + filename: 'info.log'
  17 + },
  18 + errorFile: {
  19 + name: 'error',
  20 + level: 'error',
  21 + filename: 'error.log',
  22 + handleExceptions: true
20 }, 23 },
21 udp: { // send by udp 24 udp: { // send by udp
22 - level:'debug', // logger level  
23 - host:'192.168.102.162', // influxdb host  
24 - port:'4444'// influxdb port 25 + level: 'debug', // logger level
  26 + host: '192.168.102.162', // influxdb host
  27 + port: '4444'// influxdb port
25 }, 28 },
26 - 'console':{  
27 - level:'debug', 29 + console: {
  30 + level: 'debug',
28 colorize: 'all', 31 colorize: 'all',
29 - prettyPrint:true 32 + prettyPrint: true
30 } 33 }
31 } 34 }
32 }; 35 };
@@ -7,13 +7,15 @@ @@ -7,13 +7,15 @@
7 'use strict'; 7 'use strict';
8 8
9 let winston = require('winston'), 9 let winston = require('winston'),
10 - config = require('../config/common'); 10 + config = require('../config/common'),
  11 + FileTransport = require('winston-daily-rotate-file');
11 12
12 require('influxdb-winston'); 13 require('influxdb-winston');
13 14
14 let logger = new (winston.Logger)({ 15 let logger = new (winston.Logger)({
15 transports: [ 16 transports: [
16 - new (winston.transports.File)(config.loggers.file), 17 + new (FileTransport)(config.loggers.infoFile),
  18 + new (FileTransport)(config.loggers.errorFile),
17 new (winston.transports.UdpTransport)(config.loggers.udp), 19 new (winston.transports.UdpTransport)(config.loggers.udp),
18 new (winston.transports.Console)(config.loggers.console) 20 new (winston.transports.Console)(config.loggers.console)
19 ] 21 ]
@@ -28,7 +28,8 @@ @@ -28,7 +28,8 @@
28 "morgan": "^1.7.0", 28 "morgan": "^1.7.0",
29 "request-promise": "^3.0.0", 29 "request-promise": "^3.0.0",
30 "serve-favicon": "^2.3.0", 30 "serve-favicon": "^2.3.0",
31 - "winston": "^2.2.0" 31 + "winston": "^2.2.0",
  32 + "winston-daily-rotate-file": "^1.0.1"
32 }, 33 },
33 "devDependencies": { 34 "devDependencies": {
34 "autoprefixer": "^6.3.6", 35 "autoprefixer": "^6.3.6",