diff --git a/packages/playground/src/shared/dom/index.tsx b/packages/playground/src/shared/dom/index.tsx index d1aa76f..a14ef37 100644 --- a/packages/playground/src/shared/dom/index.tsx +++ b/packages/playground/src/shared/dom/index.tsx @@ -3,7 +3,6 @@ import ReactDOM from 'react-dom' import studio from '@theatre/studio' import {getProject} from '@theatre/core' import {Scene} from './Scene' -import {TheatreLoggerLevel} from '@theatre/shared/logger' /** * This is a basic example of using Theatre for manipulating the DOM. * @@ -16,13 +15,13 @@ studio.initialize() ReactDOM.render( , document.getElementById('root'), diff --git a/theatre/core/src/coreExports.ts b/theatre/core/src/coreExports.ts index c3bce09..b4262c1 100644 --- a/theatre/core/src/coreExports.ts +++ b/theatre/core/src/coreExports.ts @@ -61,7 +61,7 @@ export function getProject(id: string, config: IProjectConfig = {}): IProject { return existingProject.publicApi } - const rootLogger = _coreLogger(config.experiments) + const rootLogger = _coreLogger() const plogger = rootLogger.named('Project', id) if (process.env.NODE_ENV !== 'production') { diff --git a/theatre/core/src/projects/Project.ts b/theatre/core/src/projects/Project.ts index 9b8c975..15e7935 100644 --- a/theatre/core/src/projects/Project.ts +++ b/theatre/core/src/projects/Project.ts @@ -66,12 +66,10 @@ export default class Project { readonly config: Conf = {}, readonly publicApi: TheatreProject, ) { - this._logger = _coreLogger(config.experiments).named('Project', id) + this._logger = _coreLogger({logging: {dev: true}}).named('Project', id) this._logger.traceDev('creating project') this.address = {projectId: id} - // remove when logger is understood - this._logger._kapow('this is a "kapow"') const onDiskStateAtom = new Atom({ ahistoric: { ahistoricStuff: '', @@ -136,7 +134,7 @@ export default class Project { `Project ${this.address.projectId} is already attached to studio ${this._studio.address.studioId}`, ) } else { - this._logger.warnDev( + console.warn( `Project ${this.address.projectId} is already attached to studio ${this._studio.address.studioId}`, ) return diff --git a/theatre/core/src/projects/TheatreProject.ts b/theatre/core/src/projects/TheatreProject.ts index 7b8ae4b..a6c2e3f 100644 --- a/theatre/core/src/projects/TheatreProject.ts +++ b/theatre/core/src/projects/TheatreProject.ts @@ -1,10 +1,7 @@ import {privateAPI, setPrivateAPI} from '@theatre/core/privateAPIs' import Project from '@theatre/core/projects/Project' import type {ISheet} from '@theatre/core/sheets/TheatreSheet' -import type { - ITheatreLoggerConfig, - ITheatreLoggingConfig, -} from '@theatre/shared/logger' + import type {ProjectAddress} from '@theatre/shared/utils/addresses' import type { ProjectId, @@ -23,23 +20,23 @@ export type IProjectConfig = { * The state of the project, as [exported](https://docs.theatrejs.com/in-depth/#exporting) by the studio. */ state?: $IntentionalAny - experiments?: IProjectConfigExperiments + // experiments?: IProjectConfigExperiments } -export type IProjectConfigExperiments = { - /** - * Defaults to using global `console` with style args. - * - * (TODO: check for browser environment before using style args) - */ - logger?: ITheatreLoggerConfig - /** - * Defaults: - * * `production` builds: console - error - * * `development` builds: console - error, warning - */ - logging?: ITheatreLoggingConfig -} +// export type IProjectConfigExperiments = { +// /** +// * Defaults to using global `console` with style args. +// * +// * (TODO: check for browser environment before using style args) +// */ +// logger?: ITheatreLoggerConfig +// /** +// * Defaults: +// * * `production` builds: console - error +// * * `development` builds: console - error, warning +// */ +// logging?: ITheatreLoggingConfig +// } /** * A Theatre project diff --git a/theatre/core/src/sequences/Sequence.ts b/theatre/core/src/sequences/Sequence.ts index 3dcc08d..1a56a35 100644 --- a/theatre/core/src/sequences/Sequence.ts +++ b/theatre/core/src/sequences/Sequence.ts @@ -145,13 +145,13 @@ export default class Sequence { this.pause() if (process.env.NODE_ENV !== 'production') { if (typeof position !== 'number') { - this._logger.errorDev( + console.error( `value t in sequence.position = t must be a number. ${typeof position} given`, ) position = 0 } if (position < 0) { - this._logger.errorDev( + console.error( `sequence.position must be a positive number. ${position} given`, ) position = 0 @@ -231,7 +231,7 @@ export default class Sequence { } if (range[1] > sequenceDuration) { - this._logger.warnDev( + console.warn( `Argument conf.range[1] in sequence.play(conf) cannot be longer than the duration of the sequence, which is ${sequenceDuration}s. ${JSON.stringify( range[1], )} given.`, diff --git a/theatre/core/src/sequences/TheatreSequence.ts b/theatre/core/src/sequences/TheatreSequence.ts index acbab23..c749ea5 100644 --- a/theatre/core/src/sequences/TheatreSequence.ts +++ b/theatre/core/src/sequences/TheatreSequence.ts @@ -239,7 +239,7 @@ export default class TheatreSequence implements ISequence { return priv.play(conf) } else { if (process.env.NODE_ENV !== 'production') { - priv._logger.warnDev( + console.warn( `You seem to have called sequence.play() before the project has finished loading.\n` + `This would **not** a problem in production when using '@theatre/core', since Theatre loads instantly in core mode. ` + `However, when using '@theatre/studio', it takes a few milliseconds for it to load your project's state, ` +