-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlogger.ts
More file actions
32 lines (28 loc) · 862 Bytes
/
logger.ts
File metadata and controls
32 lines (28 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {
Client,
ClientConfigBuilder,
} from "@polywrap/client-js";
import { loggerPlugin } from "@polywrap/logger-plugin-js";
import { Uri } from "@polywrap/core-js";
const main = async () => {
const { uri: pluginPackageUri } = Uri.from("wrapscan.io/polywrap/logger@1.0");
const { uri: wrapUri } = Uri.from("wrapscan.io/polywrap/logging@1.0.0");
const builder = new ClientConfigBuilder();
builder.setPackage(pluginPackageUri, loggerPlugin({})).addBundle("sys");
const client = new Client(builder.build());
const result = await client.invoke<boolean>({
uri: wrapUri,
method: "info",
args: {
message: "Hello from hello world wrap!",
},
});
if (!result.ok) {
throw Error("Log message error: " + result.error);
}
};
main()
.then()
.catch((e) => {
console.error("Error in Hello World example: ", e);
});