Skip to content

Commit bfb1402

Browse files
author
nmlinaric
committed
Addressed PR comment - added es logging option
1 parent f10bdb1 commit bfb1402

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@ ELASTIC_LOG_URL=http://localhost
5252
ELASTIC_LOG_PORT=9200
5353
# Elasticsearch default log level
5454
ELASTIC_LOG_LEVEL=info
55+
# Elasticsearch logging
56+
ELASTIC_LOGGING=disabled

src/Config/Config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ const config = Object.freeze({
3333
url: process.env.ELASTIC_LOG_URL || "http://localhost",
3434
port: process.env.ELASTIC_LOG_PORT || 9200,
3535
level: process.env.ELASTIC_LOG_LEVEL || "info"
36+
},
37+
logging: {
38+
es: process.env.ELASTIC_LOGGING || "disabled"
3639
}
3740
});
3841

src/Services/Logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const esTransportOpts = {
3131
} as ClientOptions,
3232
};
3333

34-
if (config.env == "prod") {
34+
if (config.env == "production" && config.logging.es.enabled) {
3535
logger.add(new (ElasticsearchTransport as any)(esTransportOpts));
3636
}
3737

0 commit comments

Comments
 (0)