The package exports 10 components for displaying logging data. All components support both server mode (with fetch functions) and client mode (with data arrays).
LoggingProvider
Provides TanStack Query context for all logging components. Use this wrapper or provide your own QueryClientProvider.
import { LoggingProvider } from "@millerbyte/react-logging";
<LoggingProvider client={existingQueryClient}>
{/* Your logging components */}
</LoggingProvider>Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | - | Child components |
client | QueryClient | Auto-created | Existing TanStack Query client |
clientOptions | QueryClientConfig | - | Config for auto-created client |
JsonDisplay
A reusable component for displaying JSON data with syntax highlighting, copy functionality, and collapsible sections. Used internally by ActionDetail and SessionDetail for formatting complex data structures.
import { JsonDisplay } from "@millerbyte/react-logging";
<JsonDisplay
data={actionDto?.CustomData}
collapsible={true}
showCopyButton={true}
title="Custom Data"
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | unknown | - | Data to display as formatted JSON |
collapsible | boolean | false | Enable expand/collapse functionality |
showCopyButton | boolean | true | Show copy to clipboard button |
title | string | - | Optional title for the JSON viewer |
className | string | - | Additional CSS class names |
SessionList
Displays a paginated, sortable table of login sessions with filtering.
<SessionList
fetchSessions={loggingClient.fetchSessions}
enablePolling
pollingInterval={15000}
onSessionClick={(session) => navigate(`/sessions/${session.Id}`)}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
sessions | TInput[] | - | Client mode: data array |
fetchSessions | (params) => Promise<PaginatedResponse> | - | Server mode: fetch function |
dataAdapter | DataAdapter | - | Transform raw data to DTOs |
pageSize | number | 10 | Items per page |
enablePolling | boolean | false | Enable auto-refresh |
pollingInterval | number | 30000 | Polling interval (ms) |
onSessionClick | (session) => void | - | Row click handler |
columns | ColumnDef[] | Default columns | Custom TanStack Table columns |
showFilters | boolean | true | Show filter controls |
labels | TableLabels | Defaults | Custom UI labels |
formatters | Formatters | - | Custom date/number formatters |
renderStates | UiStateRenderers | - | Custom loading/empty/error renders |
ActionList
Displays a paginated table of API actions with status codes, methods, and timing.
<ActionList
fetchActions={loggingClient.fetchActions}
onActionClick={(action) => navigate(`/actions/${action.Id}`)}
/>ActionList has the same props as SessionList, but usesactions and fetchActions instead of sessions.
SessionDetail
Displays detailed information about a single session including all associated actions. Supports both client mode (pass data directly) and server mode (pass fetch functions). Includes LogoutTime, EndReason badges (color-coded by reason type), and properly formatted metadata with JSON support for complex values.
// Client mode — pass data directly
<SessionDetail
session={sessionData}
actions={sessionActions}
onActionClick={(action) => navigate(`/actions/${action.Id}`)}
formatters={customFormatters}
/>
// Server mode — fetch by ID
<SessionDetail
sessionId={params.sessionId}
fetchSession={loggingClient.fetchSessionById}
fetchActions={loggingClient.fetchActions}
onActionClick={(action) => navigate(`/actions/${action.Id}`)}
enablePolling
pollingInterval={15000}
/>Props
| Prop | Type | Description |
|---|---|---|
session | TSession | Client mode: session data to display |
sessionId | string | Server mode: ID used with fetchSession |
fetchSession | (id) => Promise<TSession> | Server mode: fetch a single session by ID |
actions | TAction[] | Client mode: actions belonging to this session |
fetchActions | (params) => Promise<PaginatedResponse> | Server mode: fetch actions for this session |
onActionClick | (action) => void | Click handler for action rows — use to navigate to action detail |
dataAdapter | DataAdapter | Transform raw session data to LoginSessionDto |
actionAdapter | DataAdapter | Transform raw action data to ApiActionDto |
enablePolling | boolean | Enable auto-refresh (server mode only) |
pollingInterval | number | Polling interval in ms (default: 30000) |
formatters | Formatters | Custom date/number formatters |
renderStates | UiStateRenderers | Custom loading/empty/error renders |
className | string | Additional CSS class names |
ActionDetail
Displays comprehensive details of a single API action including request/response bodies, headers, and exception info. Now includes extensive new sections for complete observability.
<ActionDetail
action={actionData}
formatters={customFormatters}
enablePolling={true}
/>New Sections
- Requester Information: IP address, User-Agent, authentication status, user roles, claims, and headers (collapsible)
- Tracing & Diagnostics: TraceId, SpanId, ParentSpanId, CorrelationId, IdempotencyKey for distributed tracing
- Query & Route Parameters: Formatted key-value display of all URL parameters
- Log Messages: Array of log messages captured during the action
- Custom Data: Custom metadata with collapsible JSON viewer
- Enhanced Exceptions: Detailed exception breakdown with Type, Message, StackTrace (collapsible), and recursive InnerException support
- Environment & Metadata: MachineName, EnvironmentName, ApiVersion, SchemaVersion
- HTTP Method Badges: Color-coded badges for HTTP methods (GET=green, POST=blue, PUT=yellow, DELETE=red)
Props
| Prop | Type | Description |
|---|---|---|
action | ApiActionDto | Action data to display |
formatters | Formatters | Custom date/number formatters |
enablePolling | boolean | Enable auto-refresh for real-time updates |
Timeline
Chronological timeline view of sessions and actions with visual indicators.
<Timeline
sessions={sessionsData}
actions={actionsData}
onItemClick={(item) => handleTimelineClick(item)}
dateRange={{ from: startDate, to: endDate }}
maxItems={100}
/>Props
| Prop | Type | Description |
|---|---|---|
sessions | LoginSessionDto[] | Sessions to display |
actions | ApiActionDto[] | Actions to display |
onItemClick | (item) => void | Timeline item click handler |
dateRange | DateRange | Filter to date range |
maxItems | number | Maximum items to render |
formatters | Formatters | Custom date/number formatters |
Analytics
Dashboard view with aggregate metrics, status code distribution, and top endpoints. Now includes HTTP Methods Distribution and Actions Over Time charts.
<Analytics
sessions={sessionsData}
actions={actionsData}
dateRange={{ from: startDate, to: endDate }}
enablePolling={true}
/>New Charts
- HTTP Methods Distribution: Horizontal bar chart showing action counts by HTTP method (GET, POST, PUT, DELETE, PATCH) with color-coded bars
- Actions Over Time: Line chart displaying action trends over time with date labels (shown when actionsOverTime data is available)
Existing Charts
- Status Codes: Vertical bar chart of HTTP status code distribution
- Top Endpoints: Vertical bar chart showing most frequently called endpoints
Props
| Prop | Type | Description |
|---|---|---|
sessions | LoginSessionDto[] | Sessions for metrics calculation |
actions | ApiActionDto[] | Actions for metrics calculation |
dateRange | DateRange | Filter data to date range |
showCharts | boolean | Show visual charts (default: true) |
formatters | Formatters | Custom date/number formatters |
UserList
Displays a paginated, sortable table of aggregated user analytics. Shows total sessions, active sessions, last activity, first seen, and total actions per user. Added in v0.1.6.
<UserList
fetchUsers={loggingClient.fetchUsers}
onUserClick={(user) => navigate(`/users/${user.UserId}`)}
enablePolling
pollingInterval={30000}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
users | TInput[] | - | Client mode: data array |
fetchUsers | (params) => Promise<PaginatedResponse> | - | Server mode: fetch function |
dataAdapter | DataAdapter | - | Transform raw data to DTOs |
pageSize | number | 10 | Items per page |
enablePolling | boolean | false | Enable auto-refresh |
pollingInterval | number | 30000 | Polling interval (ms) |
onUserClick | (user) => void | - | Row click handler |
columns | ColumnDef[] | Default columns | Custom TanStack Table columns |
showFilters | boolean | true | Show filter controls |
labels | TableLabels | Defaults | Custom UI labels |
formatters | Formatters | - | Custom date/number formatters |
renderStates | UiStateRenderers | - | Custom loading/empty/error renders |
Filters
Standalone filter controls for building custom UIs.
<Filters
filters={filterState}
onChange={setFilterState}
config={{
showSearch: true,
showUserId: true,
showStatusCodes: true,
showDateRange: true,
}}
/>FilterConfig Options
| Option | Type | Description |
|---|---|---|
showSearch | boolean | Show text search input |
showUserId | boolean | Show user ID filter |
showTenantId | boolean | Show tenant ID filter |
showSessionId | boolean | Show session ID filter |
showStatusCodes | boolean | Show status code filter |
showMethods | boolean | Show HTTP method filter |
showIsActive | boolean | Show active session filter |
showDateRange | boolean | Show date range picker |
