All files / backend/src/logging categories.ts

50% Statements 2/4
100% Branches 0/0
0% Functions 0/2
50% Lines 2/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42          10x                   10x                                                    
/**
 * Category constants for structured logging
 */
 
// Global log categories
export const GLOBAL_CATEGORIES = {
  ELECTRON_INIT: 'electron-init',
  STANDALONE_INIT: 'standalone-init',
  LLM_CONNECTION: 'llm-connection',
  CONFIG: 'config',
  BACKEND_SERVER: 'backend-server',
  RESOURCE_DOWNLOAD: 'resource-download',
} as const;
 
// Site log categories
export const SITE_CATEGORIES = {
  SYNC: 'sync',
  CONTENT: 'content',
  BUILDACTION: 'buildaction',
  MODEL: 'model',
  IMPORT: 'import',
  WORKSPACE: 'workspace',
} as const;
 
export type GlobalCategory = typeof GLOBAL_CATEGORIES[keyof typeof GLOBAL_CATEGORIES];
export type SiteCategory = typeof SITE_CATEGORIES[keyof typeof SITE_CATEGORIES];
export type LogCategory = GlobalCategory | SiteCategory | string; // Allow extensibility
 
/**
 * Check if a category is a valid global category
 */
export function isGlobalCategory(category: string): boolean {
  return Object.values(GLOBAL_CATEGORIES).includes(category as GlobalCategory);
}
 
/**
 * Check if a category is a valid site category
 */
export function isSiteCategory(category: string): boolean {
  return Object.values(SITE_CATEGORIES).includes(category as SiteCategory);
}