@mu-online-js/mu-logger
Advanced tools
Comparing version 1.0.1 to 1.0.2
50
index.js
@@ -18,26 +18,30 @@ const {Client} = require('@elastic/elasticsearch'); | ||
const indexName = 'mu_logs'; | ||
const indexExists = await this.esClient.indices.exists({index: indexName}); | ||
if (!indexExists) { | ||
await this.esClient.indices.create({ | ||
index: indexName, | ||
body: { | ||
mappings: { | ||
properties: { | ||
app: { | ||
type: 'keyword' | ||
}, | ||
logType: { | ||
type: 'keyword' | ||
}, | ||
date: { | ||
type: 'date' | ||
}, | ||
message: { | ||
type: 'text', | ||
index: false | ||
try { | ||
const indexExists = await this.esClient.indices.exists({index: indexName}); | ||
if (!indexExists) { | ||
await this.esClient.indices.create({ | ||
index: indexName, | ||
body: { | ||
mappings: { | ||
properties: { | ||
app: { | ||
type: 'keyword' | ||
}, | ||
logType: { | ||
type: 'keyword' | ||
}, | ||
date: { | ||
type: 'date' | ||
}, | ||
message: { | ||
type: 'text', | ||
index: false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
} catch (e) { | ||
/* empty */ | ||
} | ||
@@ -56,3 +60,5 @@ } | ||
} | ||
}).then(); | ||
}).then().catch(() => { | ||
/* empty */ | ||
}); | ||
} | ||
@@ -59,0 +65,0 @@ |
{ | ||
"name": "@mu-online-js/mu-logger", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
2661
91