Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(fbt): Improve FbtResult/logging separation of concerns
Summary: We need to start eliminating these no-op mocks (which aren't customizable) and enable other callers to hook into to the same events/logic we have. Here are the beginnings of that hooking mechanism. Relevant issues (not yet fixed here): #111 #59 Reviewed By: kayhadrin Differential Revision: D18950531 fbshipit-source-id: 9ffd85d5659d40eb1f2f1a52174016bdfb8819af
- Loading branch information
1 parent
e4316fd
commit 630dea5
Showing
12 changed files
with
134 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright 2004-present Facebook. All Rights Reserved. | ||
* | ||
* @emails oncall+internationalization | ||
* @flow strict | ||
* @format | ||
*/ | ||
|
||
/** | ||
* An empty no-op for now. | ||
*/ | ||
const FbtEnv = { | ||
setup() {}, | ||
}; | ||
|
||
module.exports = FbtEnv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright 2004-present Facebook. All Rights Reserved. | ||
* | ||
* @emails oncall+internationalization | ||
* @flow strict-local | ||
* @format | ||
*/ | ||
|
||
// import typeof FbtErrorContext from 'FbtErrorContext'; | ||
|
||
export type FbtHookRegistrations = { | ||
errorListener?: (context: FbtErrorContext) => IFbtErrorListener, | ||
}; | ||
|
||
const _registrations: FbtHookRegistrations = {}; | ||
|
||
const FbtHooks = { | ||
register(registrations: FbtHookRegistrations): void { | ||
Object.assign(_registrations, registrations); | ||
}, | ||
|
||
getErrorListener(context: FbtErrorContext): ?IFbtErrorListener { | ||
const factory = _registrations.errorListener; | ||
return factory ? factory(context) : null; | ||
}, | ||
}; | ||
module.exports = FbtHooks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters