Skip to content
Draft

Rwd #33

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,7 @@ tmp
test-results/
playwright-report/
playwright/.cache/
.beads/

# WASM files copied from node_modules
site/public/ghostty-vt.wasm
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pnpm add logsdx
import { getLogsDX } from "logsdx";

// Initialize with a built-in theme
const logger = getLogsDX("dracula");
const logger = await getLogsDX({ theme: "dracula" });

// Style a log line
console.log(
Expand Down Expand Up @@ -78,22 +78,28 @@ styledLogs.forEach((line) => console.log(line));
### 3. Browser Integration (React Example)

```jsx
import { LogsDX } from "logsdx";
import { useEffect, useState } from "react";
import { getLogsDX } from "logsdx";

function LogViewer({ logs }) {
const logger = LogsDX.getInstance({
theme: "dracula",
outputFormat: "html",
htmlStyleFormat: "css",
});
const [styledLogs, setStyledLogs] = useState([]);

useEffect(() => {
async function styleLogs() {
const logger = await getLogsDX({
theme: "dracula",
outputFormat: "html",
htmlStyleFormat: "css",
});
setStyledLogs(logs.map((log) => logger.processLine(log)));
}
styleLogs();
}, [logs]);

return (
<div className="log-container">
{logs.map((log, i) => (
<div
key={i}
dangerouslySetInnerHTML={{ __html: logger.processLine(log) }}
/>
{styledLogs.map((log, i) => (
<div key={i} dangerouslySetInnerHTML={{ __html: log }} />
))}
</div>
);
Expand All @@ -104,18 +110,21 @@ function LogViewer({ logs }) {

```javascript
// Terminal output with ANSI colors
const terminalLogger = getLogsDX("dracula", {
const terminalLogger = await getLogsDX({
theme: "dracula",
outputFormat: "ansi",
});

// HTML with inline styles
const htmlLogger = getLogsDX("dracula", {
const htmlLogger = await getLogsDX({
theme: "dracula",
outputFormat: "html",
htmlStyleFormat: "css",
});

// HTML with CSS classes
const classLogger = getLogsDX("dracula", {
const classLogger = await getLogsDX({
theme: "dracula",
outputFormat: "html",
htmlStyleFormat: "className",
});
Expand Down
16 changes: 8 additions & 8 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

171 changes: 0 additions & 171 deletions docs/CREATE_THEME.md

This file was deleted.

Loading