Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New modal for logs - logger #449

Closed
lpatiny opened this issue Feb 24, 2023 · 1 comment · Fixed by #709
Closed

New modal for logs - logger #449

lpatiny opened this issue Feb 24, 2023 · 1 comment · Fixed by #709
Assignees

Comments

@lpatiny
Copy link
Contributor

lpatiny commented Feb 24, 2023

We have a new library, fifo-logger, that allows to manage logs and we plan to use in various projects.

We should be able to display the resulting logs in a table. Here is an example that can be used:

Property could be named logs

We should display:

  • Label: levelLabel
  • Message: message
  • An icon to display the stack trace if it is an error (presence of error property)
  • An icon to display the meta information if there are any properties in meta

We should also be able to filter the list by 'level' based on the following list

  • 10: trace
  • 20: debug
  • 30: info
  • 40: warn
  • 50: error
  • 60: fatal

Light background color for the line could highlight the levels:

  • pink for error and fatal
  • lightyellow for warn
  • lightgreen for info, debug and trace
    [
      {
        "level": 30,
        "time": 1677268099762,
        "message": "This is an info",
        "meta": {},
        "levelLabel": "info"
      },
      {
        "level": 40,
        "time": 1677268099763,
        "message": "This is a warning with object",
        "meta": {},
        "levelLabel": "warn"
      },
      {
        "level": 40,
        "time": 1677268099763,
        "message": "This is a warning",
        "meta": {
          "a": 1,
          "b": 2,
          "c": "Hello"
        },
        "levelLabel": "warn"
      },
      {
        "level": 50,
        "time": 1677268099763,
        "context": "c71f3fbf-dabf-4b16-b764-9e69a066f151",
        "message": "This is an error in a child",
        "meta": {},
        "levelLabel": "error"
      },
      {
        "level": 60,
        "time": 1677268099763,
        "context": "c71f3fbf-dabf-4b16-b764-9e69a066f151",
        "message": "Fatal error",
        "error": {
          "type": "Error",
          "message": "Fatal error",
          "stack": "Error: Fatal error\n    at Object.<anonymous> (/Users/lpatiny/git/cheminfo/fifo-logger/src/__tests__/FifoLogger.test.ts:16:15)\n    at Promise.then.completed (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/utils.js:293:28)\n    at new Promise (<anonymous>)\n    at callAsyncCircusFn (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/utils.js:226:10)\n    at _callCircusTest (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/run.js:248:40)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at _runTest (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/run.js:184:3)\n    at _runTestsForDescribeBlock (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/run.js:86:9)\n    at run (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/run.js:26:3)\n    at runAndTransformResultsToJestFormat (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:120:21)\n    at jestAdapter (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)\n    at runTestInternal (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-runner/build/runTest.js:367:16)\n    at runTest (/Users/lpatiny/git/cheminfo/fifo-logger/node_modules/jest-runner/build/runTest.js:444:34)"
        },
        "meta": {},
        "levelLabel": "fatal"
      },
      {
        "level": 30,
        "time": 1677268099766,
        "context": "c71f3fbf-dabf-4b16-b764-9e69a066f151",
        "message": "This is an info in a child pino",
        "meta": {},
        "levelLabel": "info"
      }
    ]

This component has been implemented in NMRium and should be moved in react-science. The same component should also be used in pixelium.

2023-08-08 13 24 49

@lpatiny lpatiny changed the title New panel for logs New panel for logs - logger Aug 8, 2023
@lpatiny lpatiny changed the title New panel for logs - logger New modal for logs - logger Aug 24, 2023
@lpatiny
Copy link
Contributor Author

lpatiny commented Apr 4, 2024

The new version of fifo-logger implements Event Listerner: cheminfo/fifo-logger@7f366a8

@stropitek stropitek self-assigned this Apr 4, 2024
@stropitek stropitek removed the discuss label Apr 4, 2024
stropitek added a commit that referenced this issue Apr 5, 2024
@stropitek stropitek linked a pull request Apr 5, 2024 that will close this issue
stropitek added a commit that referenced this issue Apr 12, 2024
Adds `FifoLoggerProvider`, `FifoLoggerDialog`, `FifoLoggerToolbarItem`, `useFifoLogger`, `useFifoLogs` to the API

Closes: #449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants