diff --git a/zenoh-ts/examples/src/main.ts b/zenoh-ts/examples/src/main.ts index 9b06dfa..3db9c08 100644 --- a/zenoh-ts/examples/src/main.ts +++ b/zenoh-ts/examples/src/main.ts @@ -38,15 +38,15 @@ async function main() { let count = 0; while (true) { await sleep(1000 * 100); - console.log("Main Loop tick ", count); + console.warn("Main Loop tick ", count); count = count + 1; } } main() - .then(() => console.log("Done")) + .then(() => console.warn("Done")) .catch((e) => { - console.log(e); + console.warn(e); throw e; }); diff --git a/zenoh-ts/examples/src/z_get.ts b/zenoh-ts/examples/src/z_get.ts index b2e4f7a..c999c6c 100644 --- a/zenoh-ts/examples/src/z_get.ts +++ b/zenoh-ts/examples/src/z_get.ts @@ -27,14 +27,14 @@ export async function get() { let resp = reply.result(); if (resp instanceof Sample) { let sample: Sample = resp; - console.log(">> Received ('", sample.keyexpr(), ":", sample.payload().deserialize(deserialize_string),"')"); + console.warn(">> Received ('", sample.keyexpr(), ":", sample.payload().deserialize(deserialize_string),"')"); } else { let reply_error: ReplyError = resp; - console.log(">> Received (ERROR: '", reply_error.payload().deserialize(deserialize_string), "')"); + console.warn(">> Received (ERROR: '", reply_error.payload().deserialize(deserialize_string), "')"); } }; - console.log("Start z_get") + console.warn("Start z_get") await session.get("demo/example/**", get_callback); // Poll receiever @@ -46,15 +46,15 @@ export async function get() { let reply = await receiver.receive(); while (reply != RecvErr.Disconnected) { if (reply == RecvErr.MalformedReply) { - console.log("MalformedReply"); + console.warn("MalformedReply"); } else { let resp = reply.result(); if (resp instanceof Sample) { let sample: Sample = resp; - console.log(">> Received ('", sample.keyexpr(), ":", sample.payload().deserialize(deserialize_string),"')"); + console.warn(">> Received ('", sample.keyexpr(), ":", sample.payload().deserialize(deserialize_string),"')"); } else { let reply_error: ReplyError = resp; - console.log(">> Received (ERROR: '{", reply_error.payload().deserialize(deserialize_string), "}')"); + console.warn(">> Received (ERROR: '{", reply_error.payload().deserialize(deserialize_string), "}')"); } } reply = await receiver.receive(); diff --git a/zenoh-ts/examples/src/z_ping.ts b/zenoh-ts/examples/src/z_ping.ts index ab3eae6..af5af26 100644 --- a/zenoh-ts/examples/src/z_ping.ts +++ b/zenoh-ts/examples/src/z_ping.ts @@ -31,7 +31,7 @@ export async function ping() { ); // Warm up - console.log("Warming up for 5 seconds..."); + console.warn("Warming up for 5 seconds..."); let startTime = new Date(); let data = [122, 101, 110, 111, 104]; @@ -52,7 +52,7 @@ export async function ping() { for (let i = 0; i < samples_out.length; i++) { let rtt = samples_out[i]; - console.log( + console.warn( data.length + "bytes: seq=" + i + diff --git a/zenoh-ts/examples/src/z_pub.ts b/zenoh-ts/examples/src/z_pub.ts index c80be99..d90b2b2 100644 --- a/zenoh-ts/examples/src/z_pub.ts +++ b/zenoh-ts/examples/src/z_pub.ts @@ -37,8 +37,8 @@ export async function pub() { for (let idx = 0; idx < Number.MAX_VALUE; idx++) { let buf = `[${idx}] ${payload}`; - console.log("Block statement execution no : " + idx); - console.log(`Putting Data ('${key_expr}': '${buf}')...`); + console.warn("Block statement execution no : " + idx); + console.warn(`Putting Data ('${key_expr}': '${buf}')...`); publisher.put(buf, Encoding.TEXT_PLAIN, "attachment"); await sleep(1000); diff --git a/zenoh-ts/examples/src/z_put.ts b/zenoh-ts/examples/src/z_put.ts index f2847fd..b93b883 100644 --- a/zenoh-ts/examples/src/z_put.ts +++ b/zenoh-ts/examples/src/z_put.ts @@ -17,7 +17,7 @@ import "./webpage.ts"; import { Config, Session } from "@ZettaScaleLabs/zenoh-ts"; export async function put() { - console.log('Running Zenoh Put !'); + console.warn('Running Zenoh Put !'); const session = await Session.open(new Config ("ws/127.0.0.1:10000")); session.put("demo/example/zenoh-ts-put", "Put from Typescript!"); diff --git a/zenoh-ts/examples/src/z_queryable.ts b/zenoh-ts/examples/src/z_queryable.ts index 1301737..47dc958 100644 --- a/zenoh-ts/examples/src/z_queryable.ts +++ b/zenoh-ts/examples/src/z_queryable.ts @@ -21,7 +21,7 @@ import { Config, KeyExpr, Query, Queryable, Session, ZBytes } from "@ZettaScaleL export async function queryable() { const session = await Session.open(new Config ("ws/127.0.0.1:10000")); let key_expr = new KeyExpr("demo/example/zenoh-ts-queryable"); - console.log("Declare Queryable on KeyExpr:", key_expr.toString()); + console.warn("Declare Queryable on KeyExpr:", key_expr.toString()); const payload = [122, 101, 110, 111, 104]; @@ -30,14 +30,14 @@ export async function queryable() { let zbytes: ZBytes | undefined = query.payload(); if (zbytes == null) { - console.log!(`>> [Queryable ] Received Query ${query.selector()}`); + console.warn!(`>> [Queryable ] Received Query ${query.selector()}`); } else { - console.log!( + console.warn!( `>> [Queryable ] Received Query ${query.selector()} with payload '${zbytes}'`, ); } - console.log( + console.warn( `>> [Queryable ] Responding ${key_expr.toString()} with payload '${payload}'`, ); query.reply(key_expr, payload); @@ -62,14 +62,14 @@ export async function queryable() { let zbytes: ZBytes | undefined = query.payload(); if (zbytes == null) { - console.log!(`>> [Queryable ] Received Query ${query.selector().toString()}`); + console.warn!(`>> [Queryable ] Received Query ${query.selector().toString()}`); } else { - console.log!( + console.warn!( `>> [Queryable ] Received Query ${query.selector()} with payload '${zbytes.buffer()}'`, ); } - console.log( + console.warn( `>> [Queryable ] Responding ${key_expr.toString()} with payload '${payload}'`, ); query.reply(key_expr, payload); diff --git a/zenoh-ts/examples/src/z_sub.ts b/zenoh-ts/examples/src/z_sub.ts index dce1cf0..fc846a0 100644 --- a/zenoh-ts/examples/src/z_sub.ts +++ b/zenoh-ts/examples/src/z_sub.ts @@ -23,7 +23,7 @@ export async function sub() { const session = await Session.open(new Config ("ws/127.0.0.1:10000")); const callback = async function (sample: Sample): Promise { - console.log!( + console.warn!( ">> [Subscriber] Received " + sample.kind() + " ('" + sample.keyexpr() + "': '" + @@ -32,7 +32,7 @@ export async function sub() { }; let key_expr = new KeyExpr("demo/example/zenoh-ts-sub"); - console.log("Declare Subscriber ", key_expr.toString()); + console.warn("Declare Subscriber ", key_expr.toString()); // Callback Subscriber take a callback which will be called upon every sample received. let callback_subscriber: Subscriber = await session.declare_subscriber( key_expr, @@ -41,7 +41,7 @@ export async function sub() { await sleep(1000 * 3); callback_subscriber.undeclare(); - console.log("Undeclare callback_subscriber"); + console.warn("Undeclare callback_subscriber"); // Poll Subscribers will only consume data on calls to receieve() // This means that interally the FIFO queue will fill up to the point that new values will be dropped @@ -49,7 +49,7 @@ export async function sub() { let poll_subscriber: Subscriber = await session.declare_subscriber("demo/example/zenoh-ts-sub", new RingChannel(10)); let sample = await poll_subscriber.receive(); while (sample != undefined) { - console.log!( + console.warn!( ">> [Subscriber] Received " + sample.kind() + " ('" + sample.keyexpr() + "': '" + diff --git a/zenoh-ts/examples/src/z_sub_thr.ts b/zenoh-ts/examples/src/z_sub_thr.ts index d33088d..c6b01b2 100644 --- a/zenoh-ts/examples/src/z_sub_thr.ts +++ b/zenoh-ts/examples/src/z_sub_thr.ts @@ -52,19 +52,19 @@ class Stats { print_round() { let elapsed_ms = Date.now() - this.round_start; let throughput = (this.round_size) / (elapsed_ms / 1000); - console.log(throughput, " msg/s"); + console.warn(throughput, " msg/s"); } } export async function thr() { - console.log("Open Session"); + console.warn("Open Session"); const session : Session = await Session.open(new Config ("ws/127.0.0.1:10000")); let stats = new Stats(100000); const subscriber_callback = async function (_sample: Sample): Promise { stats.increment(); }; - console.log("Declare subscriber"); + console.warn("Declare subscriber"); await session.declare_subscriber( "test/thr", subscriber_callback, @@ -74,7 +74,7 @@ export async function thr() { while (true) { var seconds = 100; await sleep(1000 * seconds); - console.log("Main Loop ? ", count); + console.warn("Main Loop ? ", count); count = count + 1; } } diff --git a/zenoh-ts/src/pubsub.ts b/zenoh-ts/src/pubsub.ts index c61d921..55581ab 100644 --- a/zenoh-ts/src/pubsub.ts +++ b/zenoh-ts/src/pubsub.ts @@ -81,7 +81,7 @@ export class Subscriber { */ async receive(): Promise { if (this.callback_subscriber === true) { - console.log("Cannot call `receive()` on Subscriber created with callback:"); + console.warn("Cannot call `receive()` on Subscriber created with callback:"); return; } @@ -90,7 +90,7 @@ export class Subscriber { if (opt_sample_ws != undefined) { return Sample_from_SampleWS(opt_sample_ws); } else { - console.log("Receieve returned unexpected void from RemoteSubscriber"); + console.warn("Receieve returned unexpected void from RemoteSubscriber"); return; } } diff --git a/zenoh-ts/src/query.ts b/zenoh-ts/src/query.ts index 37623b7..eb5f1e3 100644 --- a/zenoh-ts/src/query.ts +++ b/zenoh-ts/src/query.ts @@ -73,7 +73,7 @@ export class Queryable { if (this._callback_queryable === true) { let message = "Cannot call `receive()` on Subscriber created with callback:"; - console.log(message); + console.warn(message); return } @@ -84,7 +84,7 @@ export class Queryable { let reply_tx = opt_query_ws[1]; return QueryWS_to_Query(query_ws, reply_tx); } else { - console.log("Receieve returned unexpected void from RemoteQueryable"); + console.warn("Receieve returned unexpected void from RemoteQueryable"); return; } } diff --git a/zenoh-ts/src/remote_api/pubsub.ts b/zenoh-ts/src/remote_api/pubsub.ts index dd49edc..4f26f9f 100644 --- a/zenoh-ts/src/remote_api/pubsub.ts +++ b/zenoh-ts/src/remote_api/pubsub.ts @@ -65,7 +65,7 @@ export class RemotePublisher { "` id:`" + this.publisher_id + "` already undeclared"; - console.log(message); + console.warn(message); return; } @@ -93,7 +93,7 @@ export class RemotePublisher { "` id:`" + this.publisher_id + "` already undeclared"; - console.log(message); + console.warn(message); return; } this.undeclared = true; @@ -163,7 +163,7 @@ export class RemoteSubscriber { async receive(): Promise { if (this.undeclared == true) { - console.log("Subscriber keyexpr:`" + + console.warn("Subscriber keyexpr:`" + this.key_expr + "` id:`" + this.subscriber_id + @@ -172,7 +172,7 @@ export class RemoteSubscriber { } if (this.callback != undefined) { - console.log("Cannot Call receive on Subscriber created with callback:`" + + console.warn("Cannot Call receive on Subscriber created with callback:`" + this.key_expr + "` id:`" + this.subscriber_id + @@ -185,7 +185,7 @@ export class RemoteSubscriber { undeclare() { if (this.undeclared == true) { - console.log("Subscriber keyexpr:`" + + console.warn("Subscriber keyexpr:`" + this.key_expr + "` id:`" + this.subscriber_id + diff --git a/zenoh-ts/src/remote_api/query.ts b/zenoh-ts/src/remote_api/query.ts index 3ada453..85f40c4 100644 --- a/zenoh-ts/src/remote_api/query.ts +++ b/zenoh-ts/src/remote_api/query.ts @@ -107,7 +107,7 @@ export class RemoteQueryable { async receive(): Promise<[QueryWS, SimpleChannel] | void> { if (this.undeclared == true) { - console.log("Queryable keyexpr:`" + + console.warn("Queryable keyexpr:`" + this.key_expr + "` id:`" + this.queryable_id + @@ -116,7 +116,7 @@ export class RemoteQueryable { } if (this.callback != undefined) { - console.log("Cannot Call receive on Queryable created with callback:`" + + console.warn("Cannot Call receive on Queryable created with callback:`" + this.key_expr + "` id:`" + this.queryable_id + @@ -129,7 +129,7 @@ export class RemoteQueryable { undeclare() { if (this.undeclared == true) { - console.log("Queryable keyexpr:`" + + console.warn("Queryable keyexpr:`" + this.key_expr + "` id:`" + this.queryable_id + diff --git a/zenoh-ts/src/remote_api/session.ts b/zenoh-ts/src/remote_api/session.ts index 8cfb1bc..48a15a2 100644 --- a/zenoh-ts/src/remote_api/session.ts +++ b/zenoh-ts/src/remote_api/session.ts @@ -119,7 +119,7 @@ export class RemoteSession { websocket_connected = true; } else { ws = new WebSocket(websocket_endpoint); - console.log("Restart connection"); + console.warn("Restart connection"); } } @@ -348,7 +348,7 @@ export class RemoteSession { ) as RemoteAPIMsg; if ("Session" in remote_api_message) { - console.log("Continue Ignore Session Messages"); + console.warn("Continue Ignore Session Messages"); continue; } else if ("Control" in remote_api_message) { this.handle_control_message(remote_api_message["Control"]); @@ -363,12 +363,12 @@ export class RemoteSession { ); } } - console.log("Closed"); + console.warn("Closed"); } private async handle_control_message(control_msg: ControlMsg) { if (typeof control_msg === "string") { - console.log("unhandled Control Message:", control_msg); + console.warn("unhandled Control Message:", control_msg); } else if (typeof control_msg === "object") { if ("Session" in control_msg) { this.session = control_msg["Session"]; @@ -391,7 +391,7 @@ export class RemoteSession { let sample: SampleWS = data_msg["Sample"][0]; channel.send(sample); } else { - console.log("Subscrption UUID not in map", subscription_uuid); + console.warn("Subscrption UUID not in map", subscription_uuid); } } else if ("GetReply" in data_msg) { let get_reply: ReplyWS = data_msg["GetReply"]; @@ -412,17 +412,17 @@ export class RemoteSession { let query = queryable_msg.Query.query; channel.send(query); } else { - console.log("Queryable Message UUID not in map", queryable_uuid); + console.warn("Queryable Message UUID not in map", queryable_uuid); } } else if ("Reply" in queryable_msg) { // Server - console.log("Client should not receive Reply in Queryable Message"); - console.log("Replies to get queries should come via Get Reply"); + console.warn("Client should not receive Reply in Queryable Message"); + console.warn("Replies to get queries should come via Get Reply"); } else { - console.log("Queryable message Variant not recognized"); + console.warn("Queryable message Variant not recognized"); } } else { - console.log("Data Message not recognized Expected Variant", data_msg); + console.warn("Data Message not recognized Expected Variant", data_msg); } } } diff --git a/zenoh-ts/src/sample.ts b/zenoh-ts/src/sample.ts index a6217ea..f9fb145 100644 --- a/zenoh-ts/src/sample.ts +++ b/zenoh-ts/src/sample.ts @@ -147,7 +147,7 @@ export function priority_from_int(prio_u8: number): Priority { case 7: return Priority.BACKGROUND; default: - console.log("Unknown Priority Variant, default to Data"); + console.warn("Unknown Priority Variant, default to Data"); return Priority.DATA; } } @@ -334,7 +334,7 @@ export function SampleWS_from_Sample( } else if (sample.kind() == SampleKind.PUT) { sample_kind = "Put"; } else { - console.log( + console.warn( "Sample Kind not PUT | DELETE, defaulting to PUT: ", sample.kind(), );