Skip to main content
Glama

CTX: Context as Code (CaC) tool

by context-hub
MIT License
235
  • Apple
  • Linux
LogLevel.php2.05 kB
<?php declare(strict_types=1); namespace Butschster\ContextGenerator\Application\Logger; use Psr\Log\LogLevel as PsrLogLevel; /** * Enum representing log levels with their associated ANSI colors for console output. */ enum LogLevel: string { case EMERGENCY = PsrLogLevel::EMERGENCY; case ALERT = PsrLogLevel::ALERT; case CRITICAL = PsrLogLevel::CRITICAL; case ERROR = PsrLogLevel::ERROR; case WARNING = PsrLogLevel::WARNING; case NOTICE = PsrLogLevel::NOTICE; case INFO = PsrLogLevel::INFO; case DEBUG = PsrLogLevel::DEBUG; /** * Create a LogLevel enum from a string. */ public static function fromString(string $level): self { $normalizedLevel = \strtolower($level); return match ($normalizedLevel) { PsrLogLevel::EMERGENCY => self::EMERGENCY, PsrLogLevel::ALERT => self::ALERT, PsrLogLevel::CRITICAL => self::CRITICAL, PsrLogLevel::ERROR => self::ERROR, PsrLogLevel::WARNING => self::WARNING, PsrLogLevel::NOTICE => self::NOTICE, PsrLogLevel::DEBUG => self::DEBUG, default => self::INFO, // Default to INFO for unrecognized levels }; } /** * Get the ANSI color code for the log level. */ public function getAnsiColor(): string { return match ($this) { self::EMERGENCY, self::ALERT, self::CRITICAL => "\033[1;31m", // Bold Red self::ERROR => "\033[0;31m", // Red self::WARNING => "\033[0;33m", // Yellow self::NOTICE => "\033[0;32m", // Green self::INFO => "\033[0;36m", // Cyan self::DEBUG => "\033[0;90m", // Dark Gray }; } /** * Get the log level label in uppercase. */ public function getLabel(): string { return \strtoupper($this->value); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/context-hub/generator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server