Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(logs): add Flutter to logs onboarding (#63264)

Anna Garciac842e8756794
diff --git a/docs/onboarding/logs/flutter.tsx b/docs/onboarding/logs/flutter.tsx
new file mode 100644
index 000000000000..a4413f880fa4
--- /dev/null
+++ b/docs/onboarding/logs/flutter.tsx
@@ -0,0 +1,48 @@
+import { OnboardingComponentsContext, createInstallation } from 'scenes/onboarding/OnboardingDocsContentWrapper'
+
+import { getFlutterSteps as getFlutterStepsPA } from '../product-analytics/flutter'
+import { StepDefinition } from '../steps'
+
+export const getFlutterSteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
+ const { CodeBlock, Markdown, dedent } = ctx
+
+ const installSteps = getFlutterStepsPA(ctx)
+
+ const sendLogStep: StepDefinition = {
+ title: 'Send a log',
+ badge: 'required',
+ content: (
+ <>
+ <Markdown>
+ Capture a structured log record with `Posthog().logger`. Requires `posthog_flutter` 5.27.0 or later.
+ Records are batched and shipped to PostHog's logs product.
+ </Markdown>
+ <CodeBlock
+ blocks={[
+ {
+ language: 'dart',
+ file: 'Dart',
+ code: dedent`
+ import 'package:posthog_flutter/posthog_flutter.dart';
+
+ Posthog().logger.info('checkout completed', {
+ 'order_id': 'ord_789',
+ });
+ `,
+ },
+ ]}
+ />
+ <Markdown>
+ {dedent`
+ Logs appear in PostHog within a few seconds. Use the [Logs page](https://app.posthog.com/logs) to search and filter
+ by service name, severity, or any attribute you attach.
+ `}
+ </Markdown>
+ </>
+ ),
+ }
+
+ return [...installSteps, sendLogStep]
+}
+
+export const FlutterInstallation = createInstallation(getFlutterSteps)
diff --git a/docs/onboarding/logs/index.ts b/docs/onboarding/logs/index.ts
index 483e9d003be3..9f04d4082c66 100644
--- a/docs/onboarding/logs/index.ts
+++ b/docs/onboarding/logs/index.ts
@@ -1,4 +1,5 @@
export { AndroidInstallation } from './android'
+export { FlutterInstallation } from './flutter'
export { GoInstallation } from './go'
export { IOSInstallation } from './ios'
export { JavaInstallation } from './java'
diff --git a/frontend/src/scenes/onboarding/sdks/logs/LogsSDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/logs/LogsSDKInstructions.tsx
index e02b9d091f04..cbbef57eea69 100644
--- a/frontend/src/scenes/onboarding/sdks/logs/LogsSDKInstructions.tsx
+++ b/frontend/src/scenes/onboarding/sdks/logs/LogsSDKInstructions.tsx
@@ -1,5 +1,6 @@
import {
AndroidInstallation,
+ FlutterInstallation,
GoInstallation,
IOSInstallation,
JavaInstallation,
@@ -53,6 +54,10 @@ const LogsAndroidInstructionsWrapper = withOnboardingDocsWrapper({
Installation: AndroidInstallation,
})
+const LogsFlutterInstructionsWrapper = withOnboardingDocsWrapper({
+ Installation: FlutterInstallation,
+})
+
export const LogsSDKInstructions: SDKInstructionsMap = {
[SDKKey.NODE_JS]: LogsNodeJSInstructionsWrapper,
[SDKKey.NEXT_JS]: LogsNextJSInstructionsWrapper,
@@ -63,4 +68,5 @@ export const LogsSDKInstructions: SDKInstructionsMap = {
[SDKKey.IOS]: LogsIOSInstructionsWrapper,
[SDKKey.REACT_NATIVE]: LogsReactNativeInstructionsWrapper,
[SDKKey.ANDROID]: LogsAndroidInstructionsWrapper,
+ [SDKKey.FLUTTER]: LogsFlutterInstructionsWrapper,
}