mirror of https://github.com/Chocobozzz/PeerTube
Add logging for emails
parent
5a649344ff
commit
05e67d6206
|
@ -73,11 +73,39 @@ const logger = new winston.createLogger({
|
||||||
exitOnError: true
|
exitOnError: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function bunyanLogFactory (level: string) {
|
||||||
|
return function () {
|
||||||
|
let meta = null
|
||||||
|
let args = [].concat(arguments)
|
||||||
|
|
||||||
|
if (arguments[ 0 ] instanceof Error) {
|
||||||
|
meta = arguments[ 0 ].toString()
|
||||||
|
args = Array.prototype.slice.call(arguments, 1)
|
||||||
|
args.push(meta)
|
||||||
|
} else if (typeof (args[ 0 ]) !== 'string') {
|
||||||
|
meta = arguments[ 0 ]
|
||||||
|
args = Array.prototype.slice.call(arguments, 1)
|
||||||
|
args.push(meta)
|
||||||
|
}
|
||||||
|
|
||||||
|
logger[ level ].apply(logger, args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const bunyanLogger = {
|
||||||
|
trace: bunyanLogFactory('debug'),
|
||||||
|
debug: bunyanLogFactory('debug'),
|
||||||
|
info: bunyanLogFactory('info'),
|
||||||
|
warn: bunyanLogFactory('warn'),
|
||||||
|
error: bunyanLogFactory('error'),
|
||||||
|
fatal: bunyanLogFactory('error')
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
export {
|
export {
|
||||||
timestampFormatter,
|
timestampFormatter,
|
||||||
labelFormatter,
|
labelFormatter,
|
||||||
consoleLoggerFormat,
|
consoleLoggerFormat,
|
||||||
logger
|
logger,
|
||||||
|
bunyanLogger
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { createTransport, Transporter } from 'nodemailer'
|
import { createTransport, Transporter } from 'nodemailer'
|
||||||
import { UserRight } from '../../shared/models/users'
|
import { UserRight } from '../../shared/models/users'
|
||||||
import { isTestInstance } from '../helpers/core-utils'
|
import { isTestInstance } from '../helpers/core-utils'
|
||||||
import { logger } from '../helpers/logger'
|
import { bunyanLogger, logger } from '../helpers/logger'
|
||||||
import { CONFIG } from '../initializers'
|
import { CONFIG } from '../initializers'
|
||||||
import { UserModel } from '../models/account/user'
|
import { UserModel } from '../models/account/user'
|
||||||
import { VideoModel } from '../models/video/video'
|
import { VideoModel } from '../models/video/video'
|
||||||
|
@ -44,6 +44,8 @@ class Emailer {
|
||||||
host: CONFIG.SMTP.HOSTNAME,
|
host: CONFIG.SMTP.HOSTNAME,
|
||||||
port: CONFIG.SMTP.PORT,
|
port: CONFIG.SMTP.PORT,
|
||||||
secure: CONFIG.SMTP.TLS,
|
secure: CONFIG.SMTP.TLS,
|
||||||
|
debug: CONFIG.LOG.LEVEL === 'debug',
|
||||||
|
logger: bunyanLogger as any,
|
||||||
ignoreTLS: isTestInstance(),
|
ignoreTLS: isTestInstance(),
|
||||||
tls,
|
tls,
|
||||||
auth
|
auth
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
You need at least 512MB RAM to run the script.
|
You need at least 512MB RAM to run the script.
|
||||||
Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
|
Scripts can be launched directly from a PeerTube server, or from a separate server, even a desktop PC.
|
||||||
|
You need to follow all the following steps even if you are on a PeerTube server.
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
|
@ -21,20 +22,20 @@ Install the [PeerTube dependencies](dependencies.md).
|
||||||
Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
|
Clone the PeerTube repo to get the latest version (even if you are on your PeerTube server):
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/Chocobozzz/PeerTube.git
|
$ git clone https://github.com/Chocobozzz/PeerTube.git
|
||||||
CLONE="$(pwd)/PeerTube"
|
$ CLONE="$(pwd)/PeerTube"
|
||||||
```
|
```
|
||||||
|
|
||||||
Run ``yarn install``
|
Run ``yarn install``
|
||||||
```
|
```
|
||||||
cd ${CLONE}
|
$ cd ${CLONE}
|
||||||
yarn install
|
$ yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
Build server tools:
|
Build server tools:
|
||||||
```
|
```
|
||||||
cd ${CLONE}
|
$ cd ${CLONE}
|
||||||
npm run build:server
|
$ npm run build:server
|
||||||
```
|
```
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
@ -46,8 +47,8 @@ Be sure you own the videos or have the author's authorization to do so.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd ${CLONE}
|
$ cd ${CLONE}
|
||||||
node dist/server/tools/import-videos.js -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" -t "TARGET_URL"
|
$ node dist/server/tools/import-videos.js -u "PEERTUBE_URL" -U "PEERTUBE_USER" --password "PEERTUBE_PASSWORD" -t "TARGET_URL"
|
||||||
```
|
```
|
||||||
|
|
||||||
* PEERTUBE_URL : the full URL of your PeerTube server where you want to import, eg: https://peertube.cpy.re/
|
* 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
|
||||||
You can use this script to import videos directly from the CLI.
|
You can use this script to import videos directly from the CLI.
|
||||||
|
|
||||||
```
|
```
|
||||||
cd ${CLONE}
|
$ cd ${CLONE}
|
||||||
node dist/server/tools/upload.js --help
|
$ node dist/server/tools/upload.js --help
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue