-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
294 additions
and
135 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
Validating CODEOWNERS rules …
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 @@ | ||
* @d-roak @JanLewDev @elielnfinic @trungnotchung @winprn @hoangquocvietuet |
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 |
---|---|---|
@@ -1,58 +1,58 @@ | ||
{ | ||
"name": "ts-topology", | ||
"description": "The official TypeScript implementation of Topology Protocol", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
"homepage": "https://topology.gg/", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/topology-foundation/ts-topology.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/topology-foundation/ts-topology/issues" | ||
}, | ||
"workspaces": [ | ||
"packages/*", | ||
"examples/*" | ||
], | ||
"scripts": { | ||
"bench": "vitest bench", | ||
"biome-check": "biome check", | ||
"clean": "pnpm --filter '@topology-foundation/*' clean", | ||
"docs": "typedoc", | ||
"postinstall": "pnpm --filter '@topology-foundation/*' build", | ||
"proto-gen": "pnpm proto-gen:object && pnpm proto-gen:network", | ||
"proto-gen:object": "buf generate packages/object/src/proto -o packages/object/src/proto", | ||
"proto-gen:network": "buf generate packages/network/src/proto -o packages/network/src/proto", | ||
"release": "release-it", | ||
"test": "vitest" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "^1.8.3", | ||
"@release-it-plugins/workspaces": "^4.2.0", | ||
"@types/node": "^22.5.4", | ||
"assemblyscript": "^0.27.29", | ||
"release-it": "^17.6.0", | ||
"ts-proto": "^2.2.4", | ||
"typedoc": "^0.26.6", | ||
"typescript": "^5.5.4", | ||
"vite": "^5.4.9", | ||
"vite-tsconfig-paths": "^5.0.1", | ||
"vitest": "^2.1.1" | ||
}, | ||
"private": true, | ||
"release-it": { | ||
"plugins": { | ||
"@release-it-plugins/workspaces": { | ||
"publish": false | ||
} | ||
}, | ||
"npm": false, | ||
"git": { | ||
"commitMessage": "chore: release v${version}" | ||
}, | ||
"github": { | ||
"release": true | ||
} | ||
} | ||
"name": "ts-topology", | ||
"description": "The official TypeScript implementation of Topology Protocol", | ||
"version": "0.2.1-0", | ||
"license": "MIT", | ||
"homepage": "https://topology.gg/", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/topology-foundation/ts-topology.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/topology-foundation/ts-topology/issues" | ||
}, | ||
"workspaces": [ | ||
"packages/*", | ||
"examples/*" | ||
], | ||
"scripts": { | ||
"bench": "vitest bench", | ||
"biome-check": "biome check", | ||
"clean": "pnpm --filter '@topology-foundation/*' clean", | ||
"docs": "typedoc", | ||
"postinstall": "pnpm --filter '@topology-foundation/*' build", | ||
"proto-gen": "pnpm proto-gen:object && pnpm proto-gen:network", | ||
"proto-gen:object": "buf generate packages/object/src/proto -o packages/object/src/proto", | ||
"proto-gen:network": "buf generate packages/network/src/proto -o packages/network/src/proto", | ||
"release": "release-it", | ||
"test": "vitest" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "^1.8.3", | ||
"@release-it-plugins/workspaces": "^4.2.0", | ||
"@types/node": "^22.5.4", | ||
"assemblyscript": "^0.27.29", | ||
"release-it": "^17.6.0", | ||
"ts-proto": "^2.2.4", | ||
"typedoc": "^0.26.6", | ||
"typescript": "^5.5.4", | ||
"vite": "^5.4.9", | ||
"vite-tsconfig-paths": "^5.0.1", | ||
"vitest": "^2.1.1" | ||
}, | ||
"private": true, | ||
"release-it": { | ||
"plugins": { | ||
"@release-it-plugins/workspaces": { | ||
"publish": false | ||
} | ||
}, | ||
"npm": false, | ||
"git": { | ||
"commitMessage": "chore: release v${version}" | ||
}, | ||
"github": { | ||
"release": true | ||
} | ||
} | ||
} |
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,31 @@ | ||
# Topology Logger | ||
|
||
This package makes it easy to log messages in a structured way. | ||
|
||
## Usage | ||
|
||
This package is intended to be used as a dependency for the Topology Protocol. However, you can use it as a standalone package. For that, you can install it using: | ||
|
||
```bash | ||
# yarn | ||
yarn add @topology-foundation/logger | ||
|
||
# npm | ||
npm install @topology-foundation/logger | ||
``` | ||
|
||
### Build | ||
|
||
To build the package, you can run: | ||
|
||
```bash | ||
yarn build | ||
``` | ||
|
||
### Tests | ||
|
||
To run the tests, you can run: | ||
|
||
```bash | ||
yarn test | ||
``` |
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,33 @@ | ||
{ | ||
"name": "@topology-foundation/logger", | ||
"version": "0.2.1-0", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/topology-foundation/ts-topology.git" | ||
}, | ||
"type": "module", | ||
"types": "./dist/src/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist", | ||
"!dist/test", | ||
"!**/*.tsbuildinfo" | ||
], | ||
"exports": { | ||
".": { | ||
"types": "./dist/src/index.d.ts", | ||
"import": "./dist/src/index.js" | ||
} | ||
}, | ||
"scripts": { | ||
"build": "tsc -b", | ||
"clean": "rm -rf dist/ node_modules/", | ||
"prepack": "tsc -b", | ||
"test": "vitest" | ||
}, | ||
"dependencies": { | ||
"loglevel": "^1.9.2", | ||
"loglevel-plugin-prefix": "^0.8.4" | ||
} | ||
} |
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,28 @@ | ||
import loglevel from "loglevel"; | ||
import prefix from "loglevel-plugin-prefix"; | ||
|
||
export interface LoggerOptions { | ||
level?: loglevel.LogLevelDesc; | ||
} | ||
|
||
export class Logger { | ||
private log: loglevel.Logger; | ||
// biome-ignore lint/suspicious/noExplicitAny: Do this to allow any method to be called on the logger | ||
[key: string]: any; | ||
|
||
constructor(context: string, config?: LoggerOptions) { | ||
this.log = loglevel.getLogger(context); | ||
this.log.setLevel(config?.level || "info"); | ||
prefix.reg(loglevel); | ||
prefix.apply(this.log, { | ||
template: "%n", | ||
}); | ||
|
||
for (const method of Object.keys(this.log)) { | ||
const logMethod = this.log[method as keyof loglevel.Logger]; | ||
if (typeof logMethod === "function") { | ||
this[method as string] = logMethod.bind(this.log); | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
}, | ||
"include": ["src/**/*.ts"] | ||
} |
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,6 @@ | ||
{ | ||
"$schema": "https://typedoc.org/schema.json", | ||
"includeVersion": true, | ||
"entryPoints": ["src/index.ts"], | ||
"readme": "README.md" | ||
} |
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.