1.2.26 • Published 2 years ago

@diwala/logger v1.2.26

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@diwala/logger

This module has two sub-modules. error-logging and analytics. Services in both must implement the interface defined in AbstractLoggerService.

Note: In micro-frontend architecture, error logging should be managed inside each app separately. Two apps should not share the same instance of a error logger. Fex we need to have separate Sentry projects for each micro-frontend. Analytics on the other hand should be platform-wide. Meaning we have singleton services for analytics throughout the whole platform.

Error logging

error-logging sub-module exposes,

How to use

import { ErrorLogging } from '@diwala/logger';

export const errorLogger = new ErrorLogging.SentryErrorLogger(initData); //Use this instance of error logger anywhere in the micro-app.

const error = new DiwalaWebError('ErrorName', 'Message', 'FunctionError'); // We can use DiwalaWebError.fromError(error: Error | string) to create errors with type 'General'
errorLogger.push(error); //.push() accepts Error and string types as well.

single-spa-react provides a built-in react error boundary. We can make use of it to handle all errors thrown anywhere in the app. So in the entry file of the single-spa react micro app,

const lifecycles = singleSpaReact({
  React,
  ReactDOM,
  rootComponent: Root,
  errorBoundary(err) {
    if (err) errorLogger.push(err);
    return (
      <ErrorFallback
        image={Avatars.AVATAR_2}
        title="Oops!"
        description="Something went wrong at our end. It’s not you, it’s us. Sorry about that."
      />
    );
  },
});

Analytics

analytics sub-module exposes,

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.12

2 years ago

1.2.13

2 years ago

1.2.10

2 years ago

1.2.11

2 years ago

1.2.16

2 years ago

1.2.14

2 years ago

1.2.18

2 years ago

1.2.19

2 years ago

1.2.20

2 years ago

1.2.23

2 years ago

1.2.24

2 years ago

1.2.21

2 years ago

1.2.25

2 years ago

1.2.26

2 years ago

1.2.9

2 years ago

1.2.4

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.0.8

3 years ago

1.1.2

3 years ago

1.0.10

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.2

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.20

4 years ago

0.0.21

4 years ago

0.0.10

4 years ago

0.0.22

4 years ago

0.0.11

4 years ago

0.0.23

4 years ago

0.0.12

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.9

4 years ago

0.0.16

4 years ago

0.0.8

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.19

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago