-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #584 from namecheap/bugfix/log-operationid
fix(ilc/server): add path and operationId to log
- Loading branch information
Showing
14 changed files
with
143 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function setErrorData(error: Error, data: Record<string, string | number | boolean>): void { | ||
if ('data' in error && typeof error.data === 'object' && error.data !== null) { | ||
Object.assign(error.data, data); | ||
} else { | ||
Object.defineProperty(error, 'data', { enumerable: true, writable: false, value: data }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import newrelic from 'newrelic'; | ||
import extendError from '@namecheap/error-extender'; | ||
import { setErrorData } from '../util/helpers'; | ||
import { getLogger } from '../util/logger'; | ||
|
||
function noticeError(error: Error, errorInfo = {}): void { | ||
const additionalInfo = Object.assign({}, errorInfo); | ||
newrelic.noticeError(error, additionalInfo); | ||
type ErrorAttributes = { [key: string]: string | number | boolean }; | ||
|
||
const ExtendedError = extendError(error.name); | ||
getLogger().error(new ExtendedError({ cause: error, data: additionalInfo, message: error.message })); | ||
export function noticeError(error: Error, customAttributes: ErrorAttributes = {}): void { | ||
newrelic.noticeError(error, { ...customAttributes }); | ||
setErrorData(error, customAttributes); | ||
getLogger().error(error); | ||
} | ||
|
||
export default noticeError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.