Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging support to Playground #1035

Merged
merged 37 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6b21516
Basic error logging
bgrgicak Feb 13, 2024
d804cec
Move logger to a new file
bgrgicak Feb 14, 2024
8480857
Update log message param
bgrgicak Feb 14, 2024
7f2c27a
Cleanup
bgrgicak Feb 14, 2024
46542e5
Return n lines
bgrgicak Feb 14, 2024
315a622
Move logger to website
bgrgicak Feb 16, 2024
c23dd92
Display debug.log for request
bgrgicak Feb 16, 2024
60aa62f
Rewrite compiler error to return all error data
bgrgicak Feb 16, 2024
0923c3e
Remove test log
bgrgicak Feb 16, 2024
6d6bdaf
Clean up
bgrgicak Feb 16, 2024
d13033d
Merge branch 'trunk' into add/wp-logs
bgrgicak Feb 16, 2024
194bcbd
Merge branch 'add/wp-logs' of https://github.com/WordPress/wordpress-…
bgrgicak Feb 16, 2024
b84bdc0
Collect PHP logs on compile error
bgrgicak Feb 19, 2024
46ca5ee
Merge branch 'trunk' into add/wp-logs
bgrgicak Feb 19, 2024
42e47d8
Move logger to blueprints
bgrgicak Feb 19, 2024
3ea93c5
Remove unused dependency
bgrgicak Feb 19, 2024
b1b1c71
Fix linter error
bgrgicak Feb 19, 2024
c3e2c77
Move logger length to Logger
bgrgicak Feb 19, 2024
9eed92f
Cleanup unused changes
bgrgicak Feb 19, 2024
cabbd9b
Address feedback
bgrgicak Feb 21, 2024
5ab98c7
Reset base-php
bgrgicak Feb 21, 2024
6ec3c4a
Merge branch 'trunk' into add/wp-logs
bgrgicak Feb 21, 2024
c9f0b5c
Move logger to package
bgrgicak Feb 22, 2024
f28c20a
Start logger in client and node
bgrgicak Feb 22, 2024
65dd662
Merge branch 'trunk' into add/wp-logs
bgrgicak Feb 22, 2024
be90919
Remove node logger
bgrgicak Feb 23, 2024
d0398a3
Set WP_DEBUG only if WP exists
bgrgicak Feb 23, 2024
0650878
Update packages/playground/logger/logger.ts
bgrgicak Feb 23, 2024
a192ceb
Update packages/playground/remote/src/lib/playground-mu-plugin/playgr…
bgrgicak Feb 23, 2024
06158e7
Merge branch 'trunk' into add/wp-logs
bgrgicak Feb 23, 2024
b14f4a5
Move logger to a buildable package
bgrgicak Feb 26, 2024
d0546aa
Fix linter
bgrgicak Feb 26, 2024
451ede1
Merge branch 'trunk' into add/wp-logs
bgrgicak Feb 26, 2024
1d840ed
Move logger code to main plugin file
bgrgicak Feb 27, 2024
a3feb32
Attach JS logger in Website only
bgrgicak Feb 28, 2024
ef4993b
Revert compile error
bgrgicak Feb 28, 2024
988a9a5
Move window log collection to main
bgrgicak Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { usePlayground } from '../../lib/hooks';
import { StorageType } from '../../types';
import PlaygroundContext from './context';
import { logTrackingEvent } from '../../lib/tracking';
import { collectWindowErrors, logger } from '@php-wasm/logger';

export const supportedDisplayModes = [
'browser',
Expand Down Expand Up @@ -50,10 +49,6 @@ export default function PlaygroundViewport({
}
}, [blueprint?.steps]);

useEffect(() => {
collectWindowErrors(logger);
}, []);

return (
<PlaygroundContext.Provider
value={{
Expand Down
7 changes: 6 additions & 1 deletion packages/playground/website/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import { acquireOAuthTokenIfNeeded } from './github/acquire-oauth-token-if-neede
import { GithubImportModal } from './github/github-import-form';
import { GithubExportMenuItem } from './components/toolbar-buttons/github-export-menu-item';
import { GithubExportModal } from './github/github-export-form';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { ExportFormValues } from './github/github-export-form/form';
import { joinPaths } from '@php-wasm/util';
import { PlaygroundContext } from './playground-context';
import { collectWindowErrors, logger } from '@php-wasm/logger';

const query = new URL(document.location.href).searchParams;
const blueprint = await resolveBlueprint();
Expand Down Expand Up @@ -82,6 +83,10 @@ function Main() {
Partial<ExportFormValues>
>({});

useEffect(() => {
collectWindowErrors(logger);
Copy link
Collaborator

@adamziel adamziel Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could even be a top-level call outside of the Main component , e.g. right after the imports – this way it would also collect all the errors that happened before React had a chance to render.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move it in the next pr.

}, []);

return (
<PlaygroundContext.Provider value={{ storage }}>
<PlaygroundViewport
Expand Down
Loading