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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! # rconsole - WebSocket-based logging library for Rust
//!
//! A logging library that sends structured log messages to the
//! [Server Log](https://github.com/nicholasgasior/nconsole) app via WebSocket.
//!
//! Mirrors the API of the Flutter `nconsole` package, providing
//! `console.log`/`info`/`warn`/`error`/`group`/`clear` equivalents.
//!
//! ## Architecture
//!
//! ```text
//! ┌──────────────┐
//! │ NConsole │ ← Public API façade (services layer)
//! └──────┬───────┘
//! │
//! ┌──────▼───────┐
//! │ WebConsole │ ← Singleton, manages state & dispatch (console layer)
//! └──────┬───────┘
//! │
//! ┌──────▼───────┐
//! │ WsConnection │ ← WebSocket transport (infrastructure layer)
//! └──────────────┘
//! ```
//!
//! ## Quick Start
//!
//! ```no_run
//! use rconsole::*;
//! use serde_json::json;
//!
//! // Point to your Server Log app
//! NConsole::set_uri("192.168.1.100");
//!
//! // Log with mixed types — like console.log(a, b, c) in JavaScript
//! nlog!("Hello from Rust!", 42, true, json!({"key": "val"}));
//! ninfo!("Server started on port", 8080);
//! nwarn!("Memory usage:", 85.5, "%");
//! nerror!("Connection failed", json!({"code": 500}));
//!
//! // Grouped logging
//! ngroup!("HTTP Request");
//! nlog!("GET", "/api/users");
//! nlog!("Status:", 200);
//! ngroup_end!();
//!
//! // Clear console
//! nclear!();
//! ```
//!
//! ## Thread Safety
//!
//! All public methods on `NConsole` are thread-safe. The internal
//! `WebConsole` singleton is protected by a `Mutex`.
// Macros must be declared before other modules that use them
// Re-export the most commonly used types at crate root
pub use ClientInfo;
pub use ;
pub use NConsole;