Skip to content

Commit e7bb5ee

Browse files
author
Phil Varner
authored
log search and response at debug level (#365)
* log response at debug level, fix a few other error loggings * remove unused ignore from audit * update changelog * fix name of WARN log level in readme
1 parent 5f558a7 commit e7bb5ee

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased - TBD
9+
10+
### Changed
11+
12+
- Search query and response body is now logged at level DEBUG rather than INFO
13+
- Ingested item body is now logged at level DEBUG rather than INFO
14+
815
## [0.5.2] - 2023-01-17
916

1017
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ There are some settings that should be reviewed and updated as needeed in the se
403403
| STAC_DESCRIPTION | Description of this catalog | A STAC API |
404404
| STAC_DOCS_URL | URL to documentation | [https://stac-utils.github.io/stac-server](https://stac-utils.github.io/stac-server) |
405405
| INGEST_BATCH_SIZE | Number of records to ingest in single batch | 500 |
406-
| LOG_LEVEL | Level for logging (CRITICAL, ERROR, WARNING, INFO, DEBUG) | INFO |
406+
| LOG_LEVEL | Level for logging (CRITICAL, ERROR, WARN, INFO, DEBUG) | INFO |
407407
| STAC_API_URL | The root endpoint of this API | Inferred from request |
408408
| ENABLE_TRANSACTIONS_EXTENSION | Boolean specifying if the [Transaction Extension](https://github.com/radiantearth/stac-api-spec/tree/master/ogcapi-features/extensions/transaction) should be activated | false |
409409
| STAC_API_ROOTPATH | The path to append to URLs if this is not deployed at the server root. For example, if the server is deployed without a custom domain name, it will have the stage name (e.g., dev) in the path. | "" |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"test:system": "./bin/system-tests.sh",
1717
"test:unit": "ava tests/unit/*.[tj]s",
1818
"typecheck": "tsc",
19-
"audit-prod": "npx better-npm-audit audit --production --exclude 1087958",
19+
"audit-prod": "npx better-npm-audit audit --production",
2020
"deploy": "sls deploy",
2121
"package": "sls package",
2222
"serve": "STAC_API_URL=http://localhost:3000 ENABLE_TRANSACTIONS_EXTENSION=true nodemon ./src/lambdas/api/local.ts",

src/lambdas/ingest/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports.handler = async function handler(event, context) {
6262

6363
try {
6464
await ingest.ingestItems(stacItems, stream)
65-
logger.info(`Ingested ${stacItems.length} Items: ${JSON.stringify(stacItems)}`)
65+
logger.debug(`Ingested ${stacItems.length} Items: ${JSON.stringify(stacItems)}`)
6666
} catch (error) {
6767
console.log(error)
6868
throw (error)

src/lib/database.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ async function deleteItem(collectionId, itemId) {
323323
}
324324

325325
async function dbQuery(parameters) {
326-
logger.info(`Search database query: ${JSON.stringify(parameters)}`)
326+
logger.debug(`Search query: ${JSON.stringify(parameters)}`)
327327
const client = await dbClient.client()
328328
if (client === undefined) throw new Error('Client is undefined')
329329
const response = await client.search(parameters)
330-
logger.info(`Response: ${JSON.stringify(response)}`)
330+
logger.debug(`Response: ${JSON.stringify(response)}`)
331331
return response
332332
}
333333

src/lib/ingest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function ingestItem(item, stream) {
1212
dbStream,
1313
(error) => {
1414
if (error) {
15-
logger.info(error)
15+
logger.error(`Error ingesting: ${error}`)
1616
reject(error)
1717
} else {
1818
logger.info(`Ingested item ${item.id}`)
@@ -36,7 +36,7 @@ async function ingestItems(items, stream) {
3636
dbStream,
3737
(error) => {
3838
if (error) {
39-
logger.info(error)
39+
logger.error(`Error ingesting: ${error}`)
4040
reject(error)
4141
} else {
4242
logger.debug('Ingested item')

0 commit comments

Comments
 (0)