Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

createMockLogger.js.flow 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // @flow
  2. import {
  3. logLevels,
  4. } from '../constants';
  5. import type {
  6. LoggerType,
  7. MessageContextType,
  8. MessageEventHandlerType,
  9. TranslateMessageFunctionType,
  10. } from '../types';
  11. const createMockLogger = (onMessage: MessageEventHandlerType, parentContext?: MessageContextType): LoggerType => {
  12. // eslint-disable-next-line id-length, unicorn/prevent-abbreviations, no-unused-vars
  13. const log = (a, b, c, d, e, f, g, h, i, k) => {
  14. //
  15. };
  16. log.adopt = async (routine) => {
  17. return routine();
  18. };
  19. // eslint-disable-next-line no-unused-vars
  20. log.child = (context: TranslateMessageFunctionType | MessageContextType): LoggerType => {
  21. return createMockLogger(onMessage, parentContext);
  22. };
  23. log.getContext = (): MessageContextType => {
  24. return {};
  25. };
  26. for (const logLevel of Object.keys(logLevels)) {
  27. // eslint-disable-next-line id-length, unicorn/prevent-abbreviations
  28. log[logLevel] = (a, b, c, d, e, f, g, h, i, k) => {
  29. return log.child({
  30. logLevel: logLevels[logLevel],
  31. })(a, b, c, d, e, f, g, h, i, k);
  32. };
  33. }
  34. // @see https://github.com/facebook/flow/issues/6705
  35. // $FlowFixMe
  36. return log;
  37. };
  38. export default createMockLogger;