> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Write log

> Write a log entry to the server logs with specified level and metadata.



## OpenAPI

````yaml /openapi.json post /log
openapi: 3.1.1
info:
  title: cognitio
  description: cognitio api
  version: 1.0.0
servers: []
security: []
paths:
  /log:
    post:
      summary: Write log
      description: Write a log entry to the server logs with specified level and metadata.
      operationId: app.log
      parameters:
        - in: query
          name: directory
          schema:
            type: string
        - in: query
          name: workspace
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                service:
                  description: Service name for the log entry
                  type: string
                level:
                  description: Log level
                  type: string
                  enum:
                    - debug
                    - info
                    - error
                    - warn
                message:
                  description: Log message
                  type: string
                extra:
                  description: Additional metadata for the log entry
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
              required:
                - service
                - level
                - message
      responses:
        '200':
          description: Log entry written successfully
          content:
            application/json:
              schema:
                type: boolean
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
      x-codeSamples:
        - lang: js
          source: |-
            import { createCognitioClient } from "@cognitio/sdk

            const client = createCognitioClient()
            await client.app.log({
              ...
            })
components:
  schemas:
    BadRequestError:
      type: object
      properties:
        data: {}
        errors:
          type: array
          items:
            type: object
            propertyNames:
              type: string
            additionalProperties: {}
        success:
          type: boolean
          const: false
      required:
        - data
        - errors
        - success

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.