File tree Expand file tree Collapse file tree 5 files changed +58
-1
lines changed Expand file tree Collapse file tree 5 files changed +58
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { logger } from '@microsoft/teams-js' ;
2
+ import React , { ReactElement } from 'react' ;
3
+
4
+ import { ApiWithoutInput } from './utils' ;
5
+ import { ModuleWrapper } from './utils/ModuleWrapper' ;
6
+
7
+ const TurnOnConsoleLog = ( ) : React . ReactElement =>
8
+ ApiWithoutInput ( {
9
+ name : 'turnOnConsoleLog' ,
10
+ title : 'Turn On Console Log' ,
11
+ onClick : async ( ) => {
12
+ logger . turnOnConsoleLog ( ) ;
13
+ return 'true' ;
14
+ } ,
15
+ } ) ;
16
+
17
+ const TurnOffConsoleLog = ( ) : React . ReactElement =>
18
+ ApiWithoutInput ( {
19
+ name : 'turnOffConsoleLog' ,
20
+ title : 'Turn Off Console Log' ,
21
+ onClick : async ( ) => {
22
+ logger . turnOffConsoleLog ( ) ;
23
+ return 'true' ;
24
+ } ,
25
+ } ) ;
26
+ const LoggerAPIs = ( ) : ReactElement => (
27
+ < ModuleWrapper title = "Logger" >
28
+ < TurnOnConsoleLog />
29
+ < TurnOffConsoleLog />
30
+ </ ModuleWrapper >
31
+ ) ;
32
+
33
+ export default LoggerAPIs ;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import GeoLocationAPIs from '../components/GeoLocationAPIs';
22
22
import HostEntityTabAPIs from '../components/HostEntityTabAPIs' ;
23
23
import Links from '../components/Links' ;
24
24
import LocationAPIs from '../components/LocationAPIs' ;
25
+ import LoggerAPIs from '../components/LoggerAPIs' ;
25
26
import LogAPIs from '../components/LogsAPIs' ;
26
27
import MailAPIs from '../components/MailAPIs' ;
27
28
import MarketplaceAPIs from '../components/MarketplaceAPIs' ;
@@ -124,6 +125,7 @@ export const TestApp: React.FC = () => {
124
125
< Links />
125
126
< LocationAPIs />
126
127
< LogAPIs />
128
+ < LoggerAPIs />
127
129
< MailAPIs />
128
130
< MarketplaceAPIs />
129
131
< MediaAPIs />
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ const createDebuggerFunction = (namespace: string): Debugger => {
20
20
// eslint-disable-next-line @typescript-eslint/no-explicit-any
21
21
const func = function ( formatter : any , ...args : any [ ] ) : void {
22
22
if ( GlobalVars . turnOnConsoleLog ) {
23
+ internalDebugger ( formatter , args ) ;
23
24
console . log ( formatter , args ) ;
24
25
}
25
- internalDebugger ( formatter , args ) ;
26
26
} as Debugger ;
27
27
28
28
Object . assign ( func , {
Original file line number Diff line number Diff line change @@ -119,3 +119,4 @@ export { settings } from './settings';
119
119
export { tasks } from './tasks' ;
120
120
export { liveShare , LiveShareHost } from './liveShareHost' ;
121
121
export { marketplace } from './marketplace' ;
122
+ export { logger } from './logger' ;
Original file line number Diff line number Diff line change
1
+ import { GlobalVars } from '../internal/globalVars' ;
2
+
3
+ export namespace logger {
4
+ /**
5
+ * todo: doc
6
+ * @returns bool
7
+ */
8
+ export function turnOnConsoleLog ( ) : boolean {
9
+ GlobalVars . turnOnConsoleLog = true ;
10
+ return GlobalVars . turnOnConsoleLog ;
11
+ }
12
+
13
+ /**
14
+ * todo: doc
15
+ * @returns bool
16
+ */
17
+ export function turnOffConsoleLog ( ) : boolean {
18
+ GlobalVars . turnOnConsoleLog = false ;
19
+ return GlobalVars . turnOnConsoleLog ;
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments