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.

1.4 KB
Raw Blame
import { useActions } from 'kea'

import { IconCopy } from '@posthog/icons'

import { IconLink } from 'lib/lemon-ui/icons'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { copyToClipboard } from 'lib/utils/copyToClipboard'

import { ParsedLogMessage } from 'products/logs/frontend/types'

import { logsViewerLogic } from './logsViewerLogic'

interface LogsViewerRowActionsProps {
    log: ParsedLogMessage
}

export function LogsViewerRowActions({ log }: LogsViewerRowActionsProps): JSX.Element {
    const { copyLinkToLog } = useActions(logsViewerLogic)

    return (
        <More
            overlay={
                <>
                    <LemonButton
                        onClick={() => copyToClipboard(log.body, 'log message')}
                        fullWidth
                        sideIcon={<IconCopy />}
                        data-attr="logs-viewer-copy-message"
                    >
                        Copy log message
                    </LemonButton>
                    <LemonButton
                        onClick={() => copyLinkToLog(log.uuid)}
                        fullWidth
                        sideIcon={<IconLink />}
                        data-attr="logs-viewer-copy-link"
                    >
                        Copy link to log
                    </LemonButton>
                </>
            }
        />
    )
}