Skip to content

LogViewer

Log lines to read and search: time, level, where they came from and the message. Filter by level and by words; long logs paginate. On phones the time and level sit above the message.

import { LogViewer, LogViewerSkeleton } from '@sypnia/ui/react'

On this page
  1. 640 lines
  2. Loading and empty
  3. Skeleton
  4. When to use it
  5. For everyone
  6. Props

640 lines

Filter by level, search «500» and move through the pages.

  1. errorapiGET /orders 500: the database did not answer in 5 s
  2. infoapiGET /customers 200 41 ms
  3. infoapiGET /products 200 42 ms
  4. infoapiGET /auth/login 200 43 ms
  5. infoapiGET /orders 200 44 ms
  6. debugapiGET /customers 200 45 ms
  7. infoapiGET /products 200 46 ms
  8. infoapiGET /auth/login 200 47 ms
  9. infoapiGET /orders 200 48 ms
  10. infoapiGET /customers 200 49 ms
  11. debugapiGET /products 200 50 ms
  12. warnapiGET /auth/login took 1.8 s
  13. infoapiGET /orders 200 52 ms
  14. infoapiGET /customers 200 53 ms
  15. infoapiGET /products 200 54 ms
  16. debugapiGET /auth/login 200 55 ms
  17. infoapiGET /orders 200 56 ms
  18. infoapiGET /customers 200 57 ms
  19. infoapiGET /products 200 58 ms
  20. infoapiGET /auth/login 200 59 ms
  21. debugapiGET /orders 200 60 ms
  22. infoapiGET /customers 200 61 ms
  23. warnapiGET /products took 1.8 s
  24. infoapiGET /auth/login 200 63 ms
  25. infoapiGET /orders 200 64 ms
  26. debugapiGET /customers 200 65 ms
  27. infoapiGET /products 200 66 ms
  28. infoapiGET /auth/login 200 67 ms
  29. infoapiGET /orders 200 68 ms
  30. infoapiGET /customers 200 69 ms
  31. debugapiGET /products 200 70 ms
  32. infoapiGET /auth/login 200 71 ms
  33. infoapiGET /orders 200 72 ms
  34. warnapiGET /customers took 1.8 s
  35. infoapiGET /products 200 74 ms
  36. debugapiGET /auth/login 200 75 ms
  37. infoapiGET /orders 200 76 ms
  38. errorapiGET /customers 500: the database did not answer in 5 s
  39. infoapiGET /products 200 78 ms
  40. infoapiGET /auth/login 200 79 ms
  41. debugapiGET /orders 200 80 ms
  42. infoapiGET /customers 200 81 ms
  43. infoapiGET /products 200 82 ms
  44. infoapiGET /auth/login 200 83 ms
  45. warnapiGET /orders took 1.8 s
  46. debugapiGET /customers 200 85 ms
  47. infoapiGET /products 200 86 ms
  48. infoapiGET /auth/login 200 87 ms
  49. infoapiGET /orders 200 88 ms
  50. infoapiGET /customers 200 89 ms
  51. debugapiGET /products 200 90 ms
  52. infoapiGET /auth/login 200 91 ms
  53. infoapiGET /orders 200 92 ms
  54. infoapiGET /customers 200 93 ms
  55. infoapiGET /products 200 94 ms
  56. warnapiGET /auth/login took 1.8 s
  57. infoapiGET /orders 200 96 ms
  58. infoapiGET /customers 200 97 ms
  59. infoapiGET /products 200 98 ms
  60. infoapiGET /auth/login 200 99 ms
  61. debugapiGET /orders 200 40 ms
  62. infoapiGET /customers 200 41 ms
  63. infoapiGET /products 200 42 ms
  64. infoapiGET /auth/login 200 43 ms
  65. infoapiGET /orders 200 44 ms
  66. debugapiGET /customers 200 45 ms
  67. warnapiGET /products took 1.8 s
  68. infoapiGET /auth/login 200 47 ms
  69. infoapiGET /orders 200 48 ms
  70. infoapiGET /customers 200 49 ms
  71. debugapiGET /products 200 50 ms
  72. infoapiGET /auth/login 200 51 ms
  73. infoapiGET /orders 200 52 ms
  74. infoapiGET /customers 200 53 ms
  75. errorapiGET /products 500: the database did not answer in 5 s
  76. debugapiGET /auth/login 200 55 ms
  77. infoapiGET /orders 200 56 ms
  78. warnapiGET /customers took 1.8 s
  79. infoapiGET /products 200 58 ms
  80. infoapiGET /auth/login 200 59 ms
  81. debugapiGET /orders 200 60 ms
  82. infoapiGET /customers 200 61 ms
  83. infoapiGET /products 200 62 ms
  84. infoapiGET /auth/login 200 63 ms
  85. infoapiGET /orders 200 64 ms
  86. debugapiGET /customers 200 65 ms
  87. infoapiGET /products 200 66 ms
  88. infoapiGET /auth/login 200 67 ms
  89. warnapiGET /orders took 1.8 s
  90. infoapiGET /customers 200 69 ms
  91. debugapiGET /products 200 70 ms
  92. infoapiGET /auth/login 200 71 ms
  93. infoapiGET /orders 200 72 ms
  94. infoapiGET /customers 200 73 ms
  95. infoapiGET /products 200 74 ms
  96. debugapiGET /auth/login 200 75 ms
  97. infoapiGET /orders 200 76 ms
  98. infoapiGET /customers 200 77 ms
  99. infoapiGET /products 200 78 ms
  100. warnapiGET /auth/login took 1.8 s
1–100 of 640
Code
import { useMemo } from 'react';
import { LogViewer, type LogLine } from '@sypnia/ui/react';

const paths = ['/orders', '/customers', '/products', '/auth/login'];
// 640 lines of an API: filter by level, search for words, and move through the pages.
export default function Tail() {
  const lines = useMemo<LogLine[]>(() => Array.from({ length: 640 }, (_, i) => {
    const level = i % 37 === 0 ? 'error' : i % 11 === 0 ? 'warn' : i % 5 === 0 ? 'debug' : 'info';
    const path = paths[i % paths.length];
    return {
      id: i, time: Date.UTC(2026, 10, 17, 12, 0, 0) - i * 7000, level, source: 'api',
      message: level === 'error' ? `GET ${path} 500: the database did not answer in 5 s` : level === 'warn' ? `GET ${path} took 1.8 s` : `GET ${path} 200 ${40 + (i % 60)} ms`,
    };
  }), []);
  return <LogViewer label="API logs" lines={lines} />;
}

Loading and empty

Choose a state.

Code
import { useState } from 'react';
import { LogViewer, SegmentedControl } from '@sypnia/ui/react';

// Loading draws skeleton lines; with no lines it says so.
export default function States() {
  const [state, setState] = useState('loading');
  return (
    <div className="sy-stack">
      <SegmentedControl label="State" value={state} onChange={setState} options={[{ value: 'loading', label: 'Loading' }, { value: 'empty', label: 'Empty' }]} />
      <LogViewer label="Worker logs" lines={state === 'empty' ? [] : undefined} loading={state === 'loading'} />
    </div>
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

  1. infocronBackup finished in 4 min
Code
import { LogViewer, LogViewerSkeleton } from '@sypnia/ui/react';

// Before anything is known, beside a real one.
export default function Skeleton() {
  return (
    <div className="sy-stack">
      <LogViewer label="Cron logs" lines={[{ time: Date.UTC(2026, 10, 17, 3, 0), level: 'info', source: 'cron', message: 'Backup finished in 4 min' }]} />
      <LogViewerSkeleton lines={3} />
    </div>
  );
}

When to use it

Use it when

  • The logs of a service, a job or a deploy.

Do not use it when

  • It is a short session of commands: Terminal.
  • It is a list of events for people, not machines: Timeline.

For everyone

  • Levels are buttons that say whether they are on; errors carry an icon and the word, not only red.
  • While loading it draws skeleton lines and is busy; with no lines it says so.

Props

LogViewerTypeDefault
labelrequired string
linesrequired LogLine[] | undefined
empty ReactNode
loading boolean
pageSize number 100
LogViewerSkeletonTypeDefault
lines number 8
pagination boolean
  1. 640 lines
  2. Loading and empty
  3. Skeleton
  4. When to use it
  5. For everyone
  6. Props

    Search pages, sections and terms