Merge pull request #4302 from cloudskytian/staging
Console access log output is now controlled by enableAccessLog
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ disableCsrfProtection: false
|
||||
securityOverride: false
|
||||
# -- LOGGING CONFIGURATION --
|
||||
logging:
|
||||
# Enable access logging to access.log file
|
||||
# Enable access logging to access.log file and console output
|
||||
# Records new connections with timestamp, IP address and user agent
|
||||
enableAccessLog: true
|
||||
# Minimum log level to display in the terminal (DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3)
|
||||
|
||||
@@ -37,11 +37,11 @@ export default function accessLoggerMiddleware() {
|
||||
|
||||
if (!knownIPs.has(clientIp)) {
|
||||
// Log new connection
|
||||
console.info(color.yellow(`New connection from ${clientIp}; User Agent: ${userAgent}\n`));
|
||||
knownIPs.add(clientIp);
|
||||
|
||||
// Write to access log if enabled
|
||||
if (enableAccessLog) {
|
||||
console.info(color.yellow(`New connection from ${clientIp}; User Agent: ${userAgent}\n`));
|
||||
const logPath = getAccessLogPath();
|
||||
const timestamp = new Date().toISOString();
|
||||
const log = `${timestamp} ${clientIp} ${userAgent}\n`;
|
||||
|
||||
Reference in New Issue
Block a user