Skip to content

Commit

Permalink
Use pass in logger for ml modules (#969)
Browse files Browse the repository at this point in the history
  • Loading branch information
linsang21 authored Nov 8, 2024
1 parent a2d7461 commit c42aed1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Change to use loggers from `LoggerProvider` as default when initialize background blur/replacement processor.

### Fixed

## [3.9.0] - 2024-04-12
Expand Down
8 changes: 2 additions & 6 deletions src/providers/BackgroundBlurProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import {
BackgroundBlurProcessor,
BackgroundBlurVideoFrameProcessor,
BackgroundFilterSpec,
ConsoleLogger,
DefaultVideoTransformDevice,
Device,
LogLevel,
NoOpVideoFrameProcessor,
} from 'amazon-chime-sdk-js';
import React, {
Expand Down Expand Up @@ -51,7 +49,8 @@ export const BackgroundBlurProvider: FC<React.PropsWithChildren<Props>> = ({
options,
children,
}) => {
const logger = useLogger();
let logger = useLogger();
logger = options?.logger || logger;
const [isBackgroundBlurSupported, setIsBackgroundBlurSupported] = useState<
boolean | undefined
>(undefined);
Expand Down Expand Up @@ -158,9 +157,6 @@ export const BackgroundBlurProvider: FC<React.PropsWithChildren<Props>> = ({
);
const currentProcessor = await initializeBackgroundBlur();
try {
const logger =
options?.logger ||
new ConsoleLogger('BackgroundBlurProvider', LogLevel.INFO);
if (currentProcessor) {
const chosenVideoTransformDevice = new DefaultVideoTransformDevice(
logger,
Expand Down
8 changes: 2 additions & 6 deletions src/providers/BackgroundReplacementProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import {
BackgroundReplacementOptions,
BackgroundReplacementProcessor,
BackgroundReplacementVideoFrameProcessor,
ConsoleLogger,
DefaultVideoTransformDevice,
Device,
LogLevel,
NoOpVideoFrameProcessor,
} from 'amazon-chime-sdk-js';
import React, {
Expand Down Expand Up @@ -52,7 +50,8 @@ const BackgroundReplacementProviderContext = createContext<
export const BackgroundReplacementProvider: FC<
React.PropsWithChildren<Props>
> = ({ spec, options, children }) => {
const logger = useLogger();
let logger = useLogger();
logger = options?.logger || logger;
const [
isBackgroundReplacementSupported,
setIsBackgroundReplacementSupported,
Expand Down Expand Up @@ -160,9 +159,6 @@ export const BackgroundReplacementProvider: FC<
);
const currentProcessor = await initializeBackgroundReplacement();
try {
const logger =
options?.logger ||
new ConsoleLogger('BackgroundReplacementProvider', LogLevel.INFO);
if (currentProcessor) {
const chosenVideoTransformDevice = new DefaultVideoTransformDevice(
logger,
Expand Down

0 comments on commit c42aed1

Please sign in to comment.