worker_sys/
lib.rs

1#![allow(clippy::manual_non_exhaustive, clippy::empty_docs)]
2
3pub mod ext;
4pub mod types;
5
6pub use types::*;
7
8// TODO: remove the re-export of web_sys here
9pub use web_sys;
10
11/// When debugging your Worker via `wrangler dev`, `wrangler tail`, or from the Workers Dashboard,
12/// anything passed to this macro will be printed to the terminal or written to the console.
13#[macro_export]
14macro_rules! console_debug {
15    ($($t:tt)*) => {
16        $crate::web_sys::console::debug_1(&format_args!($($t)*).to_string().into())
17    }
18}
19
20/// When debugging your Worker via `wrangler dev`, `wrangler tail`, or from the Workers Dashboard,
21/// anything passed to this macro will be printed to the terminal or written to the console.
22#[macro_export]
23macro_rules! console_log {
24    ($($t:tt)*) => {
25        $crate::web_sys::console::log_1(&format_args!($($t)*).to_string().into())
26    }
27}
28
29/// When debugging your Worker via `wrangler dev`, `wrangler tail`, or from the Workers Dashboard,
30/// anything passed to this macro will be printed to the terminal or written to the console.
31#[macro_export]
32macro_rules! console_warn {
33    ($($t:tt)*) => {
34        $crate::web_sys::console::warn_1(&format_args!($($t)*).to_string().into())
35    }
36}
37
38/// When debugging your Worker via `wrangler dev`, `wrangler tail`, or from the Workers Dashboard,
39/// anything passed to this macro will be printed to the terminal or written to the console.
40#[macro_export]
41macro_rules! console_error {
42    ($($t:tt)*) => {
43        $crate::web_sys::console::error_1(&format_args!($($t)*).to_string().into())
44    }
45}