# Integration Guide

This guide shows how to integrate `os_observatory` with a `no_std` kernel.

## Setup
- Add `os_observatory` as a dependency (no external dependencies required).
- Ensure your target and panic strategy are configured for bare metal.

## Sinks
Implement `Sink` for your hardware output:
```rust
struct Uart;
impl os_observatory::sink::Sink for Uart {
    fn write_str(&self, s: &str) -> usize {
        for b in s.as_bytes() {
            uart_write_byte(*b);
        }
        s.len()
    }
}
```

## Logger
Create a logger and log messages:
```rust
use os_observatory::logging::{Logger, Level};
use os_observatory::{os_log, os_warn};

static UART: Uart = Uart;
let logger = Logger::new(&UART).with_level(Level::Info);
os_log!(&logger, "Hello from kernel");
os_warn!(&logger, "Low memory");
```

## Tracer
Record events:
```rust
use os_observatory::tracer::{EventTracer, EventId};
static TRACER: EventTracer<128> = EventTracer::new();
TRACER.record(read_cycle_counter(), EventId(10), 0x1, 0x2);
```

## Panic
Wire panic reporting:
```rust
use core::panic::PanicInfo;
use os_observatory::panic::report_panic;

#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
    report_panic(&UART, info);
    loop {}
}
```

