Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
feat: add trace option to logger (#177)
Browse files Browse the repository at this point in the history
For extra detailed logging
  • Loading branch information
achingbrain authored Feb 26, 2022
1 parent 62576c2 commit 19774eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/libp2p-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"test:electron-main": "npm run test -- -t electron-main"
},
"dependencies": {
"@libp2p/interfaces": "^1.0.0",
"@libp2p/interfaces": "^1.3.6",
"debug": "^4.3.3",
"interface-datastore": "^6.1.0",
"multiformats": "^9.6.3"
Expand Down
4 changes: 3 additions & 1 deletion packages/libp2p-logger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ debug.formatters.k = (k: Key) => {
export interface Logger {
(formatter: any, ...args: any[]): void
error: (formatter: any, ...args: any[]) => void
trace: (formatter: any, ...args: any[]) => void
enabled: boolean
}

export function logger (name: string): Logger {
return Object.assign(debug(name), {
error: debug(`${name}:error`)
error: debug(`${name}:error`),
trace: debug(`${name}:trace`)
})
}
5 changes: 5 additions & 0 deletions packages/libp2p-logger/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"include": [
"src",
"test"
],
"references": [
{
"path": "../libp2p-interfaces"
}
]
}

0 comments on commit 19774eb

Please sign in to comment.