CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-tabulate

Pretty-print tabular data in Python with extensive formatting options and output format support.

Overall
score

69%

Overview
Eval results
Files

task.mdevals/scenario-6/

Log Formatter

A utility for formatting structured log data into human-readable tables with custom delimiters.

Overview

Create a log formatter that takes structured log entries and formats them into tables using custom column separators. The formatter should support different delimiter styles for different log levels or output contexts.

Requirements

Core Functionality

The formatter must provide a function that accepts log entries (as a list of dictionaries or similar tabular data) and outputs formatted tables with customizable column separators.

Custom Separators

The formatter should support creating tables with various separator styles:

  • Pipe-delimited format (columns separated by "|")
  • Comma-delimited format (columns separated by ",")
  • Custom single-character separators
  • Custom multi-character separators (e.g., " | ", " :: ")

Input and Output

  • Input: Tabular data representing log entries with fields such as timestamp, level, message, etc.
  • Output: Formatted string representation of the table with the specified delimiter

Test Cases

  • Given a list of log entries [{"timestamp": "2024-01-01", "level": "INFO", "message": "Started"}], formatting with "|" separator produces a table with columns separated by "|" @test
  • Given a list of log entries [{"timestamp": "2024-01-01", "level": "INFO", "message": "Started"}], formatting with "," separator produces a table with columns separated by "," @test
  • Given log entries, formatting with a custom multi-character separator " :: " produces a table with columns separated by " :: " @test

Implementation

@generates

API

def format_logs(entries, separator):
    """
    Format log entries into a table with custom column separators.

    Args:
        entries: List of dictionaries containing log entry data
        separator: String to use as column separator

    Returns:
        Formatted table string with custom separators
    """
    pass

Dependencies { .dependencies }

tabulate { .dependency }

Provides table formatting capabilities with support for custom separators.

Install with Tessl CLI

npx tessl i tessl/pypi-tabulate

tile.json