### Installing Effector Logger with npm Source: https://github.com/effector/logger/blob/master/README.md This snippet shows how to install `effector` and `effector-logger` using npm. `effector-logger` should be installed as a development dependency. ```bash npm add effector npm add --dev effector-logger ``` -------------------------------- ### Installing Effector Logger with yarn Source: https://github.com/effector/logger/blob/master/README.md This snippet shows how to install `effector` and `effector-logger` using yarn. `effector-logger` should be installed as a development dependency. ```bash yarn add effector yarn add -D effector-logger ``` -------------------------------- ### Starting Effector Logger in Entrypoint Source: https://github.com/effector/logger/blob/master/README.md This TypeScript snippet demonstrates how to initialize `effector-logger` by calling `attachLogger()` in your application's entrypoint. It's crucial to import `effector-logger` at the very top to properly log initial store states. ```ts // src/index.tsx import { attachLogger } from 'effector-logger'; import React from 'react'; import { createRoot } from 'react-dom/client'; import { App } from './app'; import { appStarted } from './shared/app-events'; attachLogger(); appStarted(); createRoot(document.querySelector('#app')).render(); ``` -------------------------------- ### Starting Effector Logger with Custom Name Source: https://github.com/effector/logger/blob/master/README.md This TypeScript snippet illustrates how to provide a custom `name` option to `attachLogger()`. This prefix can be useful for distinguishing logs from multiple application instances or for more descriptive logging. ```ts attachLogger({ scope, name: `my-cool-app-${appId}` // all logs will be prefixed with this string }); ``` -------------------------------- ### Enabling Logging for Derived Effector Units Source: https://github.com/effector/logger/blob/master/README.md This TypeScript snippet demonstrates how to force logging for derived `effector` units (which are not logged by default) using `configure` with `log: 'enabled'`. This allows explicit control over what gets logged. ```ts import { createEvent } from 'effector'; import { configure } from 'effector-logger'; import { $data, loadDataFx } from './model'; const pageMounted = createEvent(); const mappedMounted = pageMounted.map((x) => x); configure(mappedMounted, { log: 'enabled' }); // You can pass multiple units as array configure([$data, loadDataFx], { log: 'enabled' }); ``` -------------------------------- ### Starting Effector Logger with Scope Source: https://github.com/effector/logger/blob/master/README.md This TypeScript snippet shows how to pass an `effector` `Scope` object to `attachLogger()`. This is necessary for applications using server-side rendering (SSR) or other scoped contexts, allowing logs to be prefixed with the scope ID. ```ts attachLogger({ scope }); ``` -------------------------------- ### Configuring Effector Babel Plugin Source: https://github.com/effector/logger/blob/master/README.md This JSON snippet demonstrates how to add the `effector/babel-plugin` to your Babel configuration to provide necessary metadata for `effector-logger`. ```json { "plugins": ["effector/babel-plugin"] } ``` -------------------------------- ### Configuring Effector Babel Plugin with Location Tracking Source: https://github.com/effector/logger/blob/master/README.md This JSON snippet shows how to enable `loc` generation in the `effector/babel-plugin` configuration. This allows `effector-logger` to display exact locations of units in the code for development environments. ```json { "plugins": [["effector/babel-plugin", { "addLoc": true }]] } ``` -------------------------------- ### Stopping Effector Logger Source: https://github.com/effector/logger/blob/master/README.md This TypeScript snippet demonstrates how to stop `effector-logger` by calling the unsubscribe function returned by `attachLogger()`. This can be used to dynamically enable or disable logging. ```ts const unlogger = attachLogger(); unlogger(); ``` -------------------------------- ### Disabling Logging for Specific Effector Units Source: https://github.com/effector/logger/blob/master/README.md This TypeScript snippet shows how to prevent specific `effector` units (events, stores, effects) from being logged using `configure` with `log: 'disabled'`. Multiple units can be passed as an array. ```ts import { createEvent } from 'effector'; import { configure } from 'effector-logger'; import { $data, loadDataFx } from './model'; const pageMounted = createEvent(); configure(pageMounted, { log: 'disabled' }); // You can pass multiple units as array configure([$data, loadDataFx], { log: 'disabled' }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.