aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/helpers/logger.ts30
-rw-r--r--server/lib/emailer.ts4
-rw-r--r--support/doc/tools.md21
3 files changed, 43 insertions, 12 deletions
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts
index e0b904950..7968b5ec9 100644
--- a/server/helpers/logger.ts
+++ b/server/helpers/logger.ts
@@ -73,11 +73,39 @@ const logger = new winston.createLogger({
73 exitOnError: true 73 exitOnError: true
74}) 74})
75 75
76function bunyanLogFactory (level: string) {
77 return function () {
78 let meta = null
79 let args = [].concat(arguments)
80
81 if (arguments[ 0 ] instanceof Error) {
82 meta = arguments[ 0 ].toString()
83 args = Array.prototype.slice.call(arguments, 1)
84 args.push(meta)
85 } else if (typeof (args[ 0 ]) !== 'string') {
86 meta = arguments[ 0 ]
87 args = Array.prototype.slice.call(arguments, 1)
88 args.push(meta)
89 }
90
91 logger[ level ].apply(logger, args)
92 }
93}
94const bunyanLogger = {
95 trace: bunyanLogFactory('debug'),
96 debug: bunyanLogFactory('debug'),
97 info: bunyanLogFactory('info'),
98 warn: bunyanLogFactory('warn'),
99 error: bunyanLogFactory('error'),
100 fatal: bunyanLogFactory('error')
101}
102
76// --------------------------------------------------------------------------- 103// ---------------------------------------------------------------------------
77 104
78export { 105export {
79 timestampFormatter, 106 timestampFormatter,
80 labelFormatter, 107 labelFormatter,
81 consoleLoggerFormat, 108 consoleLoggerFormat,
82 logger 109 logger,
110 bunyanLogger
83} 111}
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index bc0061c99..9c105a575 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -1,7 +1,7 @@
1import { createTransport, Transporter } from 'nodemailer' 1import { createTransport, Transporter } from 'nodemailer'
2import { UserRight } from '../../shared/models/users' 2import { UserRight } from '../../shared/models/users'
3import { isTestInstance } from '../helpers/core-utils' 3import { isTestInstance } from '../helpers/core-utils'
4import { logger } from '../helpers/logger' 4import { bunyanLogger, logger } from '../helpers/logger'
5import { CONFIG } from '../initializers' 5import { CONFIG } from '../initializers'
6import { UserModel } from '../models/account/user' 6import { UserModel } from '../models/account/user'
7import { VideoModel } from '../models/video/video' 7import { VideoModel } from '../models/video/video'
@@ -44,6 +44,8 @@ class Emailer {
44 host: CONFIG.SMTP.HOSTNAME, 44 host: CONFIG.SMTP.HOSTNAME,
45 port: CONFIG.SMTP.PORT, 45 port: CONFIG.SMTP.PORT,
46 secure: CONFIG.SMTP.TLS, 46 secure: CONFIG.SMTP.TLS,
47 debug: CONFIG.LOG.LEVEL === 'debug',
48 logger: bunyanLogger as any,
47 ignoreTLS: isTestInstance(), 49 ignoreTLS: isTestInstance(),
48 tls, 50 tls,
49 auth 51 auth
diff --git a/support/doc/tools.md b/support/doc/tools.md
index 144c2bd7a..d83203369 100644
--- a/support/doc/tools.md
+++ b/support/doc/tools.md
@@ -11,6 +11,7 @@
11 11
12You need at least 512MB RAM to run the script. 12You need at least 512MB RAM to run the script.
13Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC. 13Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
14You need to follow all the following steps even if you are on a PeerTube server.
14 15
15### Dependencies 16### Dependencies
16 17
@@ -21,20 +22,20 @@ Install the [PeerTube dependencies](dependencies.md).
21Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server): 22Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
22 23
23``` 24```
24git clone https://github.com/Chocobozzz/PeerTube.git 25$ git clone https://github.com/Chocobozzz/PeerTube.git
25CLONE="$(pwd)/PeerTube" 26$ CLONE="$(pwd)/PeerTube"
26``` 27```
27 28
28Run ``yarn install`` 29Run ``yarn install``
29``` 30```
30cd ${CLONE} 31$ cd ${CLONE}
31yarn install 32$ yarn install
32``` 33```
33 34
34Build server tools: 35Build server tools:
35``` 36```
36cd ${CLONE} 37$ cd ${CLONE}
37npm run build:server 38$ npm run build:server
38``` 39```
39 40
40## Tools 41## Tools
@@ -46,8 +47,8 @@ Be sure you own the videos or have the author's authorization to do so.
46 47
47 48
48``` 49```
49cd ${CLONE} 50$ cd ${CLONE}
50node dist/server/tools/import-videos.js -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" -t "TARGET_URL" 51$ node dist/server/tools/import-videos.js -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" -t "TARGET_URL"
51``` 52```
52 53
53 * PEERTUBE_URL : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re/ 54 * PEERTUBE_URL : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re/
@@ -69,6 +70,6 @@ node dist/server/tools/import-videos.js -u "PEERTUBE_URL" -U "PEERTUBE_USER" --p
69You can use this script to import videos directly from the CLI. 70You can use this script to import videos directly from the CLI.
70 71
71``` 72```
72cd ${CLONE} 73$ cd ${CLONE}
73node dist/server/tools/upload.js --help 74$ node dist/server/tools/upload.js --help
74``` 75```