@mks2508/better-logger 0.0.2-alpha.2 → 0.11.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci-quality.yml +357 -0
- package/.github/workflows/docs-demo.yml +119 -0
- package/.github/workflows/releases-core.yml +512 -0
- package/.github/workflows/releases-full.yml +582 -0
- package/.github/{workflows → workflows-backup}/ci.yml +12 -110
- package/.github/workflows-backup/nightly.yml +196 -0
- package/.github/workflows-backup/release-optimized.yml +373 -0
- package/.release-notes-0.2.0.md +129 -0
- package/.yamllint +28 -0
- package/CHANGELOG.json +749 -0
- package/CLAUDE.md +92 -1
- package/README.md +142 -498
- package/bun.lock +323 -0
- package/demo.html +9 -2
- package/dist/Logger.d.ts +176 -0
- package/dist/Logger.d.ts.map +1 -0
- package/dist/Logger.js +498 -0
- package/dist/chunks/Logger-C2-cR3No.js +2 -0
- package/dist/chunks/Logger-C2-cR3No.js.map +1 -0
- package/dist/chunks/Logger-CVwk8cgA.js +2159 -0
- package/dist/chunks/Logger-CVwk8cgA.js.map +1 -0
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
- package/dist/chunks/StyleBuilder-BoJTmskd.js +361 -0
- package/dist/chunks/StyleBuilder-BoJTmskd.js.map +1 -0
- package/dist/chunks/StyleBuilder-LPLzsoHY.js +4 -0
- package/dist/chunks/StyleBuilder-LPLzsoHY.js.map +1 -0
- package/dist/cli/CommandProcessor.d.ts +103 -0
- package/dist/cli/CommandProcessor.d.ts.map +1 -0
- package/dist/cli/CommandProcessor.js +184 -0
- package/dist/cli/commands/ConfigCommand.d.ts +17 -0
- package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
- package/dist/cli/commands/ConfigCommand.js +88 -0
- package/dist/cli/commands/ExportCommand.d.ts +51 -0
- package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
- package/dist/cli/commands/ExportCommand.js +243 -0
- package/dist/cli/commands/HistoryCommand.d.ts +50 -0
- package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
- package/dist/cli/commands/HistoryCommand.js +96 -0
- package/dist/cli/commands/StatusCommand.d.ts +33 -0
- package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
- package/dist/cli/commands/StatusCommand.js +93 -0
- package/dist/cli/commands/ThemeCommand.d.ts +33 -0
- package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
- package/dist/cli/commands/ThemeCommand.js +79 -0
- package/dist/cli/help.d.ts +15 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +118 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +46 -0
- package/dist/constants.d.ts +91 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +80 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +130 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +258 -242
- package/dist/core.js.map +1 -1
- package/dist/example.d.ts +18 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +154 -0
- package/dist/exports-module.d.ts +203 -0
- package/dist/exports-module.d.ts.map +1 -0
- package/dist/exports-module.js +260 -0
- package/dist/exports.cjs +1 -1
- package/dist/exports.cjs.map +1 -1
- package/dist/exports.js +2 -2
- package/dist/handlers/AnalyticsLogHandler.d.ts +11 -0
- package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
- package/dist/handlers/AnalyticsLogHandler.js +19 -0
- package/dist/handlers/ExportLogHandler.d.ts +103 -0
- package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
- package/dist/handlers/ExportLogHandler.js +516 -0
- package/dist/handlers/FileLogHandler.d.ts +13 -0
- package/dist/handlers/FileLogHandler.d.ts.map +1 -0
- package/dist/handlers/FileLogHandler.js +24 -0
- package/dist/handlers/RemoteLogHandler.d.ts +14 -0
- package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
- package/dist/handlers/RemoteLogHandler.js +37 -0
- package/dist/handlers/index.d.ts +8 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +7 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +89 -103
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +139 -0
- package/dist/styling/StyleBuilder.d.ts +132 -0
- package/dist/styling/StyleBuilder.d.ts.map +1 -0
- package/dist/styling/StyleBuilder.js +268 -0
- package/dist/styling/banners.d.ts +45 -0
- package/dist/styling/banners.d.ts.map +1 -0
- package/dist/styling/banners.js +155 -0
- package/dist/styling/index.d.ts +7 -0
- package/dist/styling/index.d.ts.map +1 -0
- package/dist/styling/index.js +6 -0
- package/dist/styling/themes.d.ts +10 -0
- package/dist/styling/themes.d.ts.map +1 -0
- package/dist/styling/themes.js +231 -0
- package/dist/styling-module.d.ts +185 -0
- package/dist/styling-module.d.ts.map +1 -0
- package/dist/styling-module.js +199 -0
- package/dist/styling.cjs +1 -1
- package/dist/styling.cjs.map +1 -1
- package/dist/styling.js +4 -4
- package/dist/types/Logger.d.ts +172 -0
- package/dist/types/Logger.d.ts.map +1 -0
- package/dist/types/cli/CommandProcessor.d.ts +100 -0
- package/dist/types/cli/CommandProcessor.d.ts.map +1 -0
- package/dist/types/cli/commands/ConfigCommand.d.ts +14 -0
- package/dist/types/cli/commands/ConfigCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/ExportCommand.d.ts +48 -0
- package/dist/types/cli/commands/ExportCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/HistoryCommand.d.ts +47 -0
- package/dist/types/cli/commands/HistoryCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/StatusCommand.d.ts +30 -0
- package/dist/types/cli/commands/StatusCommand.d.ts.map +1 -0
- package/dist/types/cli/commands/ThemeCommand.d.ts +30 -0
- package/dist/types/cli/commands/ThemeCommand.d.ts.map +1 -0
- package/dist/types/cli/help.d.ts +12 -0
- package/dist/types/cli/help.d.ts.map +1 -0
- package/dist/types/cli/index.d.ts +15 -0
- package/dist/types/cli/index.d.ts.map +1 -0
- package/dist/types/constants.d.ts +88 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/core.d.ts +71 -211
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +13 -0
- package/dist/types/example.d.ts +18 -0
- package/dist/types/example.d.ts.map +1 -0
- package/dist/types/exports-module.d.ts +196 -0
- package/dist/types/exports-module.d.ts.map +1 -0
- package/dist/types/handlers/AnalyticsLogHandler.d.ts +8 -0
- package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/ExportLogHandler.d.ts +100 -0
- package/dist/types/handlers/ExportLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/FileLogHandler.d.ts +10 -0
- package/dist/types/handlers/FileLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/RemoteLogHandler.d.ts +11 -0
- package/dist/types/handlers/RemoteLogHandler.d.ts.map +1 -0
- package/dist/types/handlers/index.d.ts +8 -0
- package/dist/types/handlers/index.d.ts.map +1 -0
- package/dist/types/handlers.d.ts +88 -0
- package/dist/types/handlers.d.ts.map +1 -0
- package/dist/types/handlers.js +4 -0
- package/dist/types/index.d.ts +7 -675
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/main.d.ts +2 -0
- package/dist/types/main.d.ts.map +1 -0
- package/dist/types/styling/StyleBuilder.d.ts +132 -0
- package/dist/types/styling/StyleBuilder.d.ts.map +1 -0
- package/dist/types/styling/banners.d.ts +42 -0
- package/dist/types/styling/banners.d.ts.map +1 -0
- package/dist/types/styling/index.d.ts +7 -0
- package/dist/types/styling/index.d.ts.map +1 -0
- package/dist/types/styling/themes.d.ts +7 -0
- package/dist/types/styling/themes.d.ts.map +1 -0
- package/dist/types/styling-module.d.ts +178 -0
- package/dist/types/styling-module.d.ts.map +1 -0
- package/dist/types/types/core.d.ts +71 -0
- package/dist/types/types/core.d.ts.map +1 -0
- package/dist/types/types/handlers.d.ts +85 -0
- package/dist/types/types/handlers.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +7 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/output.d.ts +29 -0
- package/dist/types/utils/output.d.ts.map +1 -0
- package/dist/types/utils/stackTrace.d.ts +6 -0
- package/dist/types/utils/stackTrace.d.ts.map +1 -0
- package/dist/types/utils/timestamps.d.ts +20 -0
- package/dist/types/utils/timestamps.d.ts.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/output.d.ts +32 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +97 -0
- package/dist/utils/stackTrace.d.ts +9 -0
- package/dist/utils/stackTrace.d.ts.map +1 -0
- package/dist/utils/stackTrace.js +81 -0
- package/dist/utils/timestamps.d.ts +20 -0
- package/dist/utils/timestamps.d.ts.map +1 -0
- package/dist/utils/timestamps.js +71 -0
- package/docs/API.md +691 -0
- package/docs/DEVELOPMENT.md +731 -0
- package/docs/PACKAGES.md +244 -0
- package/docs/_config.yml +36 -0
- package/docs/index.md +179 -0
- package/examples/README.md +208 -0
- package/examples/basic-logging.js +75 -0
- package/examples/data-export.js +234 -0
- package/examples/package.json +16 -0
- package/examples/performance-timing.js +170 -0
- package/examples/styling-themes.js +207 -0
- package/package.json +32 -21
- package/packages/core/package.json +35 -0
- package/packages/exports/package.json +41 -0
- package/packages/styling/package.json +41 -0
- package/project-utils/README.md +172 -0
- package/project-utils/auto-release-gemini.ts +1193 -0
- package/project-utils/commit-generator.ts +1385 -0
- package/project-utils/commit-ui.ts +264 -0
- package/project-utils/git-utils.ts +199 -0
- package/project-utils/github-release-manager.ts +466 -0
- package/project-utils/prompt-templates.js +345 -0
- package/project-utils/prompt-templates.ts +422 -0
- package/project-utils/version-manager.ts +1078 -0
- package/src/Logger.ts +2 -1
- package/src/cli/CommandProcessor.ts +173 -2
- package/src/cli/commands/HistoryCommand.ts +117 -0
- package/src/cli/index.ts +12 -0
- package/src/handlers/ExportLogHandler.ts +141 -0
- package/tests/test-conflict-resolution.ts +391 -0
- package/tests/validate-workflows.sh +131 -0
- package/tests/yaml-autofix.sh +146 -0
- package/vite.config.ts +152 -50
- package/.claude/settings.local.json +0 -22
- package/.npmrc.bak +0 -1
- package/dist/chunks/Logger-BQhMKy_T.js +0 -2
- package/dist/chunks/Logger-BQhMKy_T.js.map +0 -1
- package/dist/chunks/Logger-BrFKFZcD.js +0 -978
- package/dist/chunks/Logger-BrFKFZcD.js.map +0 -1
- package/dist/chunks/core-2opW4Pi3.js +0 -194
- package/dist/chunks/core-2opW4Pi3.js.map +0 -1
- package/dist/chunks/core-DyugwSYZ.js +0 -4
- package/dist/chunks/core-DyugwSYZ.js.map +0 -1
- package/dist/chunks/exports-BNP3R7dp.js +0 -421
- package/dist/chunks/exports-BNP3R7dp.js.map +0 -1
- package/dist/chunks/exports-U1xLBXrY.js +0 -2
- package/dist/chunks/exports-U1xLBXrY.js.map +0 -1
- package/dist/chunks/styling-DhUDzwlE.js +0 -654
- package/dist/chunks/styling-DhUDzwlE.js.map +0 -1
- package/dist/chunks/styling-tmRDI28D.js +0 -2
- package/dist/chunks/styling-tmRDI28D.js.map +0 -1
- package/dist/types/exports.d.ts +0 -600
- package/dist/types/styling.d.ts +0 -751
- /package/.github/{workflows → workflows-backup}/release.yml +0 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts","../src/handlers/AnalyticsLogHandler.ts","../src/handlers/FileLogHandler.ts"],"sourcesContent":["/**\n * @fileoverview Better Logger - Complete library with all features\n * @version 0.0.1\n * \n * This is the main entry point that provides the complete Better Logger experience\n * with all advanced features including styling, SVG support, animations, export \n * capabilities, and remote logging.\n */\n\n// Main Logger class with all features\nimport { Logger } from './Logger.js';\nimport type {\n LogLevel,\n Verbosity,\n ThemeVariant,\n BannerType,\n StyleOptions,\n ILogHandler\n} from './types/index.js';\n\n// Create singleton instance with all features enabled\nconst logger = new Logger();\n\n/**\n * Main Logger class with complete feature set\n * \n * @example\n * ```typescript\n * import { Logger } from '@mks2508/better-logger';\n * \n * const logger = new Logger();\n * logger.setTheme('neon');\n * logger.info('Hello world!');\n * logger.logWithSVG('Custom SVG', svgContent);\n * ```\n */\nexport { Logger };\n\n// Export the singleton as default\nexport default logger;\n\n// Individual logging methods (bound to singleton)\nexport const debug = (...args: any[]) => logger.debug(...args);\nexport const info = (...args: any[]) => logger.info(...args);\nexport const warn = (...args: any[]) => logger.warn(...args);\nexport const error = (...args: any[]) => logger.error(...args);\nexport const success = (...args: any[]) => logger.success(...args);\nexport const critical = (...args: any[]) => logger.critical(...args);\nexport const trace = (...args: any[]) => logger.trace(...args);\nexport const table = (data: any, columns?: string[]) => logger.table(data, columns);\nexport const group = (label: string, collapsed?: boolean) => logger.group(label, collapsed);\nexport const groupEnd = () => logger.groupEnd();\nexport const time = (label: string) => logger.time(label);\nexport const timeEnd = (label: string) => logger.timeEnd(label);\nexport const setGlobalPrefix = (prefix: string) => logger.setGlobalPrefix(prefix);\nexport const createScopedLogger = (prefix: string) => logger.createScopedLogger(prefix);\nexport const setVerbosity = (level: Verbosity) => logger.setVerbosity(level);\nexport const addHandler = (handler: ILogHandler) => logger.addHandler(handler);\nexport const setTheme = (theme: ThemeVariant) => logger.setTheme(theme);\nexport const setBannerType = (bannerType: BannerType) => logger.setBannerType(bannerType);\nexport const showBanner = (bannerType?: BannerType) => logger.showBanner(bannerType);\nexport const logWithSVG = (message: string, svgContent?: string, options?: StyleOptions) => \n logger.logWithSVG(message, svgContent, options);\nexport const logAnimated = (message: string, duration?: number) => \n logger.logAnimated(message, duration);\nexport const cli = (command: string) => logger.cli(command);\n\n// Type exports\nexport type {\n LogLevel,\n Verbosity,\n ThemeVariant,\n BannerType,\n StyleOptions,\n ILogHandler,\n LoggerConfig,\n LogMetadata,\n StackInfo,\n TimerEntry\n} from './types/index.js';\n\n// Styling utilities\nexport { \n StyleBuilder,\n StylePresets,\n THEME_PRESETS,\n THEME_BANNERS,\n BANNER_VARIANTS\n} from './styling/index.js';\n\n// Handler exports\nexport {\n FileLogHandler,\n RemoteLogHandler,\n AnalyticsLogHandler\n} from './handlers/index.js';\n\n// Constants\nexport { DEFAULT_CONFIG } from './constants.js';\n\n// Utility exports\nexport {\n parseStackTrace,\n formatTimestamp\n} from './utils/index.js';\n\n/**\n * Styling utilities for creating custom console styles\n * \n * @example\n * ```typescript\n * import { createStyle, stylePresets } from '@mks2508/better-logger';\n * \n * const customStyle = createStyle()\n * .bg('linear-gradient(45deg, #ff6b6b, #feca57)')\n * .color('white')\n * .padding('10px')\n * .build();\n * \n * console.log('%cStyled message', customStyle);\n * console.log('%cSuccess!', stylePresets.success);\n * ```\n */\nimport { StyleBuilder, StylePresets } from './styling/index.js';\n\n/**\n * Creates a new StyleBuilder instance for custom console styling\n */\nexport const createStyle = () => new StyleBuilder();\n\n/**\n * Pre-built style presets for common use cases\n */\nexport const stylePresets = {\n success: StylePresets.success().build(),\n error: StylePresets.error().build(),\n warning: StylePresets.warning().build(),\n info: StylePresets.info().build(),\n accent: StylePresets.accent().build(),\n};","/**\n * @fileoverview Analytics log handler for Advanced Logger\n */\n\nimport type { ILogHandler, LogLevel, LogMetadata } from '../types/index.js';\n\n/**\n * Example custom handler for analytics demonstration\n */\nexport class AnalyticsLogHandler implements ILogHandler {\n handle(level: LogLevel, message: string, _args: any[], metadata: LogMetadata): void {\n // In a real implementation, this could send analytics data\n if (level === 'error' || level === 'critical') {\n // Track errors for analytics\n console.debug('Analytics: Error tracked', { \n level, \n message, \n timestamp: metadata.timestamp \n });\n }\n }\n}","/**\n * @fileoverview File-based log handler for Advanced Logger\n */\n\nimport type { ILogHandler, LogLevel, LogMetadata } from '../types/index.js';\n\n/**\n * File-based log handler for persistent logging\n */\nexport class FileLogHandler implements ILogHandler {\n private filename: string;\n\n constructor(filename: string = 'app.log') {\n this.filename = filename;\n }\n\n handle(level: LogLevel, message: string, args: any[], metadata: LogMetadata): void {\n const logEntry = {\n filename: this.filename,\n timestamp: metadata.timestamp,\n level: level.toUpperCase(),\n prefix: metadata.prefix,\n message,\n args: args.slice(1),\n location: metadata.stackInfo,\n };\n\n console.debug('File log entry:', logEntry);\n }\n}"],"names":["logger","Logger","stylePresets","success","StylePresets","build","error","warning","info","accent","handle","level","message","_args","metadata","timestamp","filename","constructor","this","args","toUpperCase","prefix","slice","stackInfo","handler","addHandler","command","cli","createScopedLogger","StyleBuilder","critical","debug","label","collapsed","group","groupEnd","duration","logAnimated","svgContent","options","logWithSVG","bannerType","setBannerType","setGlobalPrefix","theme","setTheme","setVerbosity","showBanner","data","columns","table","time","timeEnd","trace","warn"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts","../src/handlers/AnalyticsLogHandler.ts","../src/handlers/FileLogHandler.ts"],"sourcesContent":["/**\n * @fileoverview Better Logger - Complete library with all features\n * @version 0.0.1\n * \n * This is the main entry point that provides the complete Better Logger experience\n * with all advanced features including styling, SVG support, animations, export \n * capabilities, and remote logging.\n */\n\n// Main Logger class with all features\nimport { Logger } from './Logger.js';\nimport type {\n LogLevel,\n Verbosity,\n ThemeVariant,\n BannerType,\n StyleOptions,\n ILogHandler\n} from './types/index.js';\n\n// Create singleton instance with all features enabled\nconst logger = new Logger();\n\n/**\n * Main Logger class with complete feature set\n * \n * @example\n * ```typescript\n * import { Logger } from '@mks2508/better-logger';\n * \n * const logger = new Logger();\n * logger.setTheme('neon');\n * logger.info('Hello world!');\n * logger.logWithSVG('Custom SVG', svgContent);\n * ```\n */\nexport { Logger };\n\n// Export the singleton as default\nexport default logger;\n\n// Individual logging methods (bound to singleton)\nexport const debug = (...args: any[]) => logger.debug(...args);\nexport const info = (...args: any[]) => logger.info(...args);\nexport const warn = (...args: any[]) => logger.warn(...args);\nexport const error = (...args: any[]) => logger.error(...args);\nexport const success = (...args: any[]) => logger.success(...args);\nexport const critical = (...args: any[]) => logger.critical(...args);\nexport const trace = (...args: any[]) => logger.trace(...args);\nexport const table = (data: any, columns?: string[]) => logger.table(data, columns);\nexport const group = (label: string, collapsed?: boolean) => logger.group(label, collapsed);\nexport const groupEnd = () => logger.groupEnd();\nexport const time = (label: string) => logger.time(label);\nexport const timeEnd = (label: string) => logger.timeEnd(label);\nexport const setGlobalPrefix = (prefix: string) => logger.setGlobalPrefix(prefix);\nexport const createScopedLogger = (prefix: string) => logger.createScopedLogger(prefix);\nexport const setVerbosity = (level: Verbosity) => logger.setVerbosity(level);\nexport const addHandler = (handler: ILogHandler) => logger.addHandler(handler);\nexport const setTheme = (theme: ThemeVariant) => logger.setTheme(theme);\nexport const setBannerType = (bannerType: BannerType) => logger.setBannerType(bannerType);\nexport const showBanner = (bannerType?: BannerType) => logger.showBanner(bannerType);\nexport const logWithSVG = (message: string, svgContent?: string, options?: StyleOptions) => \n logger.logWithSVG(message, svgContent, options);\nexport const logAnimated = (message: string, duration?: number) => \n logger.logAnimated(message, duration);\nexport const cli = (command: string) => logger.cli(command);\n\n// Type exports\nexport type {\n LogLevel,\n Verbosity,\n ThemeVariant,\n BannerType,\n StyleOptions,\n ILogHandler,\n LoggerConfig,\n LogMetadata,\n StackInfo,\n TimerEntry\n} from './types/index.js';\n\n// Styling utilities\nexport { \n StyleBuilder,\n StylePresets,\n THEME_PRESETS,\n THEME_BANNERS,\n BANNER_VARIANTS\n} from './styling/index.js';\n\n// Handler exports\nexport {\n FileLogHandler,\n RemoteLogHandler,\n AnalyticsLogHandler\n} from './handlers/index.js';\n\n// Constants\nexport { DEFAULT_CONFIG } from './constants.js';\n\n// Utility exports\nexport {\n parseStackTrace,\n formatTimestamp\n} from './utils/index.js';\n\n/**\n * Styling utilities for creating custom console styles\n * \n * @example\n * ```typescript\n * import { createStyle, stylePresets } from '@mks2508/better-logger';\n * \n * const customStyle = createStyle()\n * .bg('linear-gradient(45deg, #ff6b6b, #feca57)')\n * .color('white')\n * .padding('10px')\n * .build();\n * \n * console.log('%cStyled message', customStyle);\n * console.log('%cSuccess!', stylePresets.success);\n * ```\n */\nimport { StyleBuilder, StylePresets } from './styling/index.js';\n\n/**\n * Creates a new StyleBuilder instance for custom console styling\n */\nexport const createStyle = () => new StyleBuilder();\n\n/**\n * Pre-built style presets for common use cases\n */\nexport const stylePresets = {\n success: StylePresets.success().build(),\n error: StylePresets.error().build(),\n warning: StylePresets.warning().build(),\n info: StylePresets.info().build(),\n accent: StylePresets.accent().build(),\n};","/**\n * @fileoverview Analytics log handler for Advanced Logger\n */\n\nimport type { ILogHandler, LogLevel, LogMetadata } from '../types/index.js';\n\n/**\n * Example custom handler for analytics demonstration\n */\nexport class AnalyticsLogHandler implements ILogHandler {\n handle(level: LogLevel, message: string, _args: any[], metadata: LogMetadata): void {\n // In a real implementation, this could send analytics data\n if (level === 'error' || level === 'critical') {\n // Track errors for analytics\n console.debug('Analytics: Error tracked', { \n level, \n message, \n timestamp: metadata.timestamp \n });\n }\n }\n}","/**\n * @fileoverview File-based log handler for Advanced Logger\n */\n\nimport type { ILogHandler, LogLevel, LogMetadata } from '../types/index.js';\n\n/**\n * File-based log handler for persistent logging\n */\nexport class FileLogHandler implements ILogHandler {\n private filename: string;\n\n constructor(filename: string = 'app.log') {\n this.filename = filename;\n }\n\n handle(level: LogLevel, message: string, args: any[], metadata: LogMetadata): void {\n const logEntry = {\n filename: this.filename,\n timestamp: metadata.timestamp,\n level: level.toUpperCase(),\n prefix: metadata.prefix,\n message,\n args: args.slice(1),\n location: metadata.stackInfo,\n };\n\n console.debug('File log entry:', logEntry);\n }\n}"],"names":["logger","Logger","stylePresets","success","StylePresets","build","error","warning","info","accent","handle","level","message","_args","metadata","timestamp","filename","constructor","this","args","toUpperCase","prefix","slice","stackInfo","handler","addHandler","command","cli","createScopedLogger","StyleBuilder","critical","debug","label","collapsed","group","groupEnd","duration","logAnimated","svgContent","options","logWithSVG","bannerType","setBannerType","setGlobalPrefix","theme","setTheme","setVerbosity","showBanner","data","columns","table","time","timeEnd","trace","warn"],"mappings":"6PAqBMA,EAAS,IAAIC,EAAAA,OAgHNC,EAAe,CACxBC,QAASC,EAAAA,aAAaD,UAAUE,QAChCC,MAAOF,EAAAA,aAAaE,QAAQD,QAC5BE,QAASH,EAAAA,aAAaG,UAAUF,QAChCG,KAAMJ,EAAAA,aAAaI,OAAOH,QAC1BI,OAAQL,EAAAA,aAAaK,SAASJ,maCjI3B,MACH,MAAAK,CAAOC,EAAiBC,EAAiBC,EAAcC,GAErC,UAAVH,GAA+B,aAAVA,GAKNG,EAASC,SAGhC,0BCXG,MACKC,SAER,WAAAC,CAAYD,EAAmB,WAC3BE,KAAKF,SAAWA,CACpB,CAEA,MAAAN,CAAOC,EAAiBC,EAAiBO,EAAaL,GAEpCI,KAAKF,SACJF,EAASC,UACbJ,EAAMS,cACLN,EAASO,OAEXF,EAAKG,MAAM,GACPR,EAASS,SAI3B,sBF6BuBC,GAAyBxB,EAAOyB,WAAWD,eAQlDE,GAAoB1B,EAAO2B,IAAID,8BAVhBL,GAAmBrB,EAAO4B,mBAAmBP,uBAyErD,IAAM,IAAIQ,EAAAA,8BAjFb,IAAIV,IAAgBnB,EAAO8B,YAAYX,iBAL1C,IAAIA,IAAgBnB,EAAO+B,SAASZ,mCAGpC,IAAIA,IAAgBnB,EAAOM,SAASa,iBAKpC,CAACa,EAAeC,IAAwBjC,EAAOkC,MAAMF,EAAOC,oBACzD,IAAMjC,EAAOmC,wBARjB,IAAIhB,IAAgBnB,EAAOQ,QAAQW,uBAoB5B,CAACP,EAAiBwB,IACzCpC,EAAOqC,YAAYzB,EAASwB,sBAHN,CAACxB,EAAiB0B,EAAqBC,IAC7DvC,EAAOwC,WAAW5B,EAAS0B,EAAYC,yBAHbE,GAA2BzC,EAAO0C,cAAcD,2BAL9CpB,GAAmBrB,EAAO2C,gBAAgBtB,oBAIjDuB,GAAwB5C,EAAO6C,SAASD,wBAFpCjC,GAAqBX,EAAO8C,aAAanC,sBAI3C8B,GAA4BzC,EAAO+C,WAAWN,0CAdlD,IAAItB,IAAgBnB,EAAOG,WAAWgB,iBAGxC,CAAC6B,EAAWC,IAAuBjD,EAAOkD,MAAMF,EAAMC,gBAGtDjB,GAAkBhC,EAAOmD,KAAKnB,mBAC3BA,GAAkBhC,EAAOoD,QAAQpB,iBALpC,IAAIb,IAAgBnB,EAAOqD,SAASlC,gBAJrC,IAAIA,IAAgBnB,EAAOsD,QAAQnC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Better Logger - Complete library with all features
|
|
3
|
+
* @version 0.0.1
|
|
4
|
+
*
|
|
5
|
+
* This is the main entry point that provides the complete Better Logger experience
|
|
6
|
+
* with all advanced features including styling, SVG support, animations, export
|
|
7
|
+
* capabilities, and remote logging.
|
|
8
|
+
*/
|
|
9
|
+
import { Logger } from './Logger.js';
|
|
10
|
+
import type { Verbosity, ThemeVariant, BannerType, StyleOptions, ILogHandler } from './types/index.js';
|
|
11
|
+
declare const logger: Logger;
|
|
12
|
+
/**
|
|
13
|
+
* Main Logger class with complete feature set
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { Logger } from '@mks2508/better-logger';
|
|
18
|
+
*
|
|
19
|
+
* const logger = new Logger();
|
|
20
|
+
* logger.setTheme('neon');
|
|
21
|
+
* logger.info('Hello world!');
|
|
22
|
+
* logger.logWithSVG('Custom SVG', svgContent);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export { Logger };
|
|
26
|
+
export default logger;
|
|
27
|
+
export declare const debug: (...args: any[]) => void;
|
|
28
|
+
export declare const info: (...args: any[]) => void;
|
|
29
|
+
export declare const warn: (...args: any[]) => void;
|
|
30
|
+
export declare const error: (...args: any[]) => void;
|
|
31
|
+
export declare const success: (...args: any[]) => void;
|
|
32
|
+
export declare const critical: (...args: any[]) => void;
|
|
33
|
+
export declare const trace: (...args: any[]) => void;
|
|
34
|
+
export declare const table: (data: any, columns?: string[]) => void;
|
|
35
|
+
export declare const group: (label: string, collapsed?: boolean) => void;
|
|
36
|
+
export declare const groupEnd: () => void;
|
|
37
|
+
export declare const time: (label: string) => void;
|
|
38
|
+
export declare const timeEnd: (label: string) => void;
|
|
39
|
+
export declare const setGlobalPrefix: (prefix: string) => void;
|
|
40
|
+
export declare const createScopedLogger: (prefix: string) => Logger;
|
|
41
|
+
export declare const setVerbosity: (level: Verbosity) => void;
|
|
42
|
+
export declare const addHandler: (handler: ILogHandler) => void;
|
|
43
|
+
export declare const setTheme: (theme: ThemeVariant) => void;
|
|
44
|
+
export declare const setBannerType: (bannerType: BannerType) => void;
|
|
45
|
+
export declare const showBanner: (bannerType?: BannerType) => void;
|
|
46
|
+
export declare const logWithSVG: (message: string, svgContent?: string, options?: StyleOptions) => void;
|
|
47
|
+
export declare const logAnimated: (message: string, duration?: number) => void;
|
|
48
|
+
export declare const cli: (command: string) => Promise<void>;
|
|
49
|
+
export type { LogLevel, Verbosity, ThemeVariant, BannerType, StyleOptions, ILogHandler, LoggerConfig, LogMetadata, StackInfo, TimerEntry } from './types/index.js';
|
|
50
|
+
export { StyleBuilder, StylePresets, THEME_PRESETS, THEME_BANNERS, BANNER_VARIANTS } from './styling/index.js';
|
|
51
|
+
export { FileLogHandler, RemoteLogHandler, AnalyticsLogHandler } from './handlers/index.js';
|
|
52
|
+
export { DEFAULT_CONFIG } from './constants.js';
|
|
53
|
+
export { parseStackTrace, formatTimestamp } from './utils/index.js';
|
|
54
|
+
/**
|
|
55
|
+
* Styling utilities for creating custom console styles
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import { createStyle, stylePresets } from '@mks2508/better-logger';
|
|
60
|
+
*
|
|
61
|
+
* const customStyle = createStyle()
|
|
62
|
+
* .bg('linear-gradient(45deg, #ff6b6b, #feca57)')
|
|
63
|
+
* .color('white')
|
|
64
|
+
* .padding('10px')
|
|
65
|
+
* .build();
|
|
66
|
+
*
|
|
67
|
+
* console.log('%cStyled message', customStyle);
|
|
68
|
+
* console.log('%cSuccess!', stylePresets.success);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
import { StyleBuilder } from './styling/index.js';
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new StyleBuilder instance for custom console styling
|
|
74
|
+
*/
|
|
75
|
+
export declare const createStyle: () => StyleBuilder;
|
|
76
|
+
/**
|
|
77
|
+
* Pre-built style presets for common use cases
|
|
78
|
+
*/
|
|
79
|
+
export declare const stylePresets: {
|
|
80
|
+
success: string;
|
|
81
|
+
error: string;
|
|
82
|
+
warning: string;
|
|
83
|
+
info: string;
|
|
84
|
+
accent: string;
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAER,SAAS,EACT,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACd,MAAM,kBAAkB,CAAC;AAG1B,QAAA,MAAM,MAAM,QAAe,CAAC;AAE5B;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,MAAM,EAAE,CAAC;AAGlB,eAAe,MAAM,CAAC;AAGtB,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAA0B,CAAC;AAC/D,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAAyB,CAAC;AAC7D,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAAyB,CAAC;AAC7D,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAA0B,CAAC;AAC/D,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,GAAG,EAAE,SAA4B,CAAC;AACnE,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,GAAG,EAAE,SAA6B,CAAC;AACrE,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAA0B,CAAC;AAC/D,eAAO,MAAM,KAAK,GAAI,MAAM,GAAG,EAAE,UAAU,MAAM,EAAE,SAAgC,CAAC;AACpF,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,YAAY,OAAO,SAAmC,CAAC;AAC5F,eAAO,MAAM,QAAQ,YAA0B,CAAC;AAChD,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,SAAuB,CAAC;AAC1D,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,SAA0B,CAAC;AAChE,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,SAAmC,CAAC;AAClF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,WAAsC,CAAC;AACxF,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,SAA+B,CAAC;AAC7E,eAAO,MAAM,UAAU,GAAI,SAAS,WAAW,SAA+B,CAAC;AAC/E,eAAO,MAAM,QAAQ,GAAI,OAAO,YAAY,SAA2B,CAAC;AACxE,eAAO,MAAM,aAAa,GAAI,YAAY,UAAU,SAAqC,CAAC;AAC1F,eAAO,MAAM,UAAU,GAAI,aAAa,UAAU,SAAkC,CAAC;AACrF,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,aAAa,MAAM,EAAE,UAAU,YAAY,SACpC,CAAC;AACpD,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,WAAW,MAAM,SACrB,CAAC;AAC1C,eAAO,MAAM,GAAG,GAAI,SAAS,MAAM,kBAAwB,CAAC;AAG5D,YAAY,EACR,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,UAAU,EACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACH,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,eAAe,EAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EACH,eAAe,EACf,eAAe,EAClB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,WAAW,oBAA2B,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,105 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const logEntry = {
|
|
13
|
-
filename: this.filename,
|
|
14
|
-
timestamp: metadata.timestamp,
|
|
15
|
-
level: level.toUpperCase(),
|
|
16
|
-
prefix: metadata.prefix,
|
|
17
|
-
message,
|
|
18
|
-
args: args.slice(1),
|
|
19
|
-
location: metadata.stackInfo
|
|
20
|
-
};
|
|
21
|
-
console.debug("File log entry:", logEntry);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class AnalyticsLogHandler {
|
|
25
|
-
handle(level, message, _args, metadata) {
|
|
26
|
-
if (level === "error" || level === "critical") {
|
|
27
|
-
console.debug("Analytics: Error tracked", {
|
|
28
|
-
level,
|
|
29
|
-
message,
|
|
30
|
-
timestamp: metadata.timestamp
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Better Logger - Complete library with all features
|
|
3
|
+
* @version 0.0.1
|
|
4
|
+
*
|
|
5
|
+
* This is the main entry point that provides the complete Better Logger experience
|
|
6
|
+
* with all advanced features including styling, SVG support, animations, export
|
|
7
|
+
* capabilities, and remote logging.
|
|
8
|
+
*/
|
|
9
|
+
// Main Logger class with all features
|
|
10
|
+
import { Logger } from './Logger.js';
|
|
11
|
+
// Create singleton instance with all features enabled
|
|
35
12
|
const logger = new Logger();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Main Logger class with complete feature set
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { Logger } from '@mks2508/better-logger';
|
|
19
|
+
*
|
|
20
|
+
* const logger = new Logger();
|
|
21
|
+
* logger.setTheme('neon');
|
|
22
|
+
* logger.info('Hello world!');
|
|
23
|
+
* logger.logWithSVG('Custom SVG', svgContent);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export { Logger };
|
|
27
|
+
// Export the singleton as default
|
|
28
|
+
export default logger;
|
|
29
|
+
// Individual logging methods (bound to singleton)
|
|
30
|
+
export const debug = (...args) => logger.debug(...args);
|
|
31
|
+
export const info = (...args) => logger.info(...args);
|
|
32
|
+
export const warn = (...args) => logger.warn(...args);
|
|
33
|
+
export const error = (...args) => logger.error(...args);
|
|
34
|
+
export const success = (...args) => logger.success(...args);
|
|
35
|
+
export const critical = (...args) => logger.critical(...args);
|
|
36
|
+
export const trace = (...args) => logger.trace(...args);
|
|
37
|
+
export const table = (data, columns) => logger.table(data, columns);
|
|
38
|
+
export const group = (label, collapsed) => logger.group(label, collapsed);
|
|
39
|
+
export const groupEnd = () => logger.groupEnd();
|
|
40
|
+
export const time = (label) => logger.time(label);
|
|
41
|
+
export const timeEnd = (label) => logger.timeEnd(label);
|
|
42
|
+
export const setGlobalPrefix = (prefix) => logger.setGlobalPrefix(prefix);
|
|
43
|
+
export const createScopedLogger = (prefix) => logger.createScopedLogger(prefix);
|
|
44
|
+
export const setVerbosity = (level) => logger.setVerbosity(level);
|
|
45
|
+
export const addHandler = (handler) => logger.addHandler(handler);
|
|
46
|
+
export const setTheme = (theme) => logger.setTheme(theme);
|
|
47
|
+
export const setBannerType = (bannerType) => logger.setBannerType(bannerType);
|
|
48
|
+
export const showBanner = (bannerType) => logger.showBanner(bannerType);
|
|
49
|
+
export const logWithSVG = (message, svgContent, options) => logger.logWithSVG(message, svgContent, options);
|
|
50
|
+
export const logAnimated = (message, duration) => logger.logAnimated(message, duration);
|
|
51
|
+
export const cli = (command) => logger.cli(command);
|
|
52
|
+
// Styling utilities
|
|
53
|
+
export { StyleBuilder, StylePresets, THEME_PRESETS, THEME_BANNERS, BANNER_VARIANTS } from './styling/index.js';
|
|
54
|
+
// Handler exports
|
|
55
|
+
export { FileLogHandler, RemoteLogHandler, AnalyticsLogHandler } from './handlers/index.js';
|
|
56
|
+
// Constants
|
|
57
|
+
export { DEFAULT_CONFIG } from './constants.js';
|
|
58
|
+
// Utility exports
|
|
59
|
+
export { parseStackTrace, formatTimestamp } from './utils/index.js';
|
|
60
|
+
/**
|
|
61
|
+
* Styling utilities for creating custom console styles
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { createStyle, stylePresets } from '@mks2508/better-logger';
|
|
66
|
+
*
|
|
67
|
+
* const customStyle = createStyle()
|
|
68
|
+
* .bg('linear-gradient(45deg, #ff6b6b, #feca57)')
|
|
69
|
+
* .color('white')
|
|
70
|
+
* .padding('10px')
|
|
71
|
+
* .build();
|
|
72
|
+
*
|
|
73
|
+
* console.log('%cStyled message', customStyle);
|
|
74
|
+
* console.log('%cSuccess!', stylePresets.success);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
import { StyleBuilder, StylePresets } from './styling/index.js';
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new StyleBuilder instance for custom console styling
|
|
80
|
+
*/
|
|
81
|
+
export const createStyle = () => new StyleBuilder();
|
|
82
|
+
/**
|
|
83
|
+
* Pre-built style presets for common use cases
|
|
84
|
+
*/
|
|
85
|
+
export const stylePresets = {
|
|
86
|
+
success: StylePresets.success().build(),
|
|
87
|
+
error: StylePresets.error().build(),
|
|
88
|
+
warning: StylePresets.warning().build(),
|
|
89
|
+
info: StylePresets.info().build(),
|
|
90
|
+
accent: StylePresets.accent().build(),
|
|
65
91
|
};
|
|
66
|
-
export {
|
|
67
|
-
AnalyticsLogHandler,
|
|
68
|
-
B as BANNER_VARIANTS,
|
|
69
|
-
D as DEFAULT_CONFIG,
|
|
70
|
-
FileLogHandler,
|
|
71
|
-
Logger,
|
|
72
|
-
R as RemoteLogHandler,
|
|
73
|
-
StyleBuilder,
|
|
74
|
-
StylePresets,
|
|
75
|
-
b as THEME_BANNERS,
|
|
76
|
-
T as THEME_PRESETS,
|
|
77
|
-
addHandler,
|
|
78
|
-
cli,
|
|
79
|
-
createScopedLogger,
|
|
80
|
-
createStyle,
|
|
81
|
-
critical,
|
|
82
|
-
debug,
|
|
83
|
-
logger as default,
|
|
84
|
-
error,
|
|
85
|
-
b2 as formatTimestamp,
|
|
86
|
-
group,
|
|
87
|
-
groupEnd,
|
|
88
|
-
info,
|
|
89
|
-
logAnimated,
|
|
90
|
-
logWithSVG,
|
|
91
|
-
a as parseStackTrace,
|
|
92
|
-
setBannerType,
|
|
93
|
-
setGlobalPrefix,
|
|
94
|
-
setTheme,
|
|
95
|
-
setVerbosity,
|
|
96
|
-
showBanner,
|
|
97
|
-
stylePresets,
|
|
98
|
-
success,
|
|
99
|
-
table,
|
|
100
|
-
time,
|
|
101
|
-
timeEnd,
|
|
102
|
-
trace,
|
|
103
|
-
warn
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=index.js.map
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { debug, info, warn, error, success, critical, table, group, groupEnd, time, timeEnd, trace, createScopedLogger, cli, setTheme, setBannerType, showBanner, logWithSVG, logAnimated, createStyle, stylePresets } from './index.js';
|
|
2
|
+
import { demonstrateBanners, demonstrateThemes, demonstrateSVG, demonstrateAnimations, demonstrateCLI, demonstrateExports, demonstrateAllFeatures as demoAllFeatures } from './example.js';
|
|
3
|
+
console.log('%cBetter Logger Demo Ready! 🚀', 'background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 10px 20px; border-radius: 8px; font-weight: bold; font-size: 14px;');
|
|
4
|
+
console.log('📋 Available test functions: testDebug(), testBanners(), testThemes(), and more!');
|
|
5
|
+
console.log('💻 CLI Available: cli("/help") for commands');
|
|
6
|
+
function testDebug() {
|
|
7
|
+
debug("This is a debug message.", { user: "test", id: 123 });
|
|
8
|
+
}
|
|
9
|
+
function testInfo() {
|
|
10
|
+
info("This is an info message with an object.", { data: "payload" });
|
|
11
|
+
}
|
|
12
|
+
function testWarn() {
|
|
13
|
+
warn("This is a warning message about a deprecated API.");
|
|
14
|
+
}
|
|
15
|
+
function testError() {
|
|
16
|
+
error("This is an error message.", new Error("Failed to fetch resource."));
|
|
17
|
+
}
|
|
18
|
+
function testSuccess() {
|
|
19
|
+
success("Operation completed successfully.");
|
|
20
|
+
}
|
|
21
|
+
function testCritical() {
|
|
22
|
+
critical("This is a CRITICAL message. System integrity compromised!");
|
|
23
|
+
}
|
|
24
|
+
function testTable() {
|
|
25
|
+
table([
|
|
26
|
+
{ feature: "Debug Log", status: "Implemented", priority: "Low" },
|
|
27
|
+
{ feature: "Info Log", status: "Implemented", priority: "Medium" },
|
|
28
|
+
{ feature: "Warning Log", status: "Implemented", priority: "High" },
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
function testGrouping() {
|
|
32
|
+
group("User Authentication Flow", true); // Start collapsed
|
|
33
|
+
info("User 'testuser' attempting to log in...");
|
|
34
|
+
warn("Password nearing expiration.");
|
|
35
|
+
success("Login successful.");
|
|
36
|
+
groupEnd();
|
|
37
|
+
}
|
|
38
|
+
function testTiming() {
|
|
39
|
+
time("dataProcessing");
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
timeEnd("dataProcessing");
|
|
42
|
+
}, 750); // Simulate a 750ms operation
|
|
43
|
+
}
|
|
44
|
+
function testScopedLogger() {
|
|
45
|
+
info("Demonstrating scoped loggers...");
|
|
46
|
+
const apiLogger = createScopedLogger("API");
|
|
47
|
+
apiLogger.info("Fetching user data...");
|
|
48
|
+
const uiLogger = createScopedLogger("UI");
|
|
49
|
+
uiLogger.debug("Rendering user profile component.");
|
|
50
|
+
apiLogger.success("User data fetched successfully.");
|
|
51
|
+
apiLogger.error("Failed to update settings.");
|
|
52
|
+
}
|
|
53
|
+
function testTrace() {
|
|
54
|
+
function innerFunction() {
|
|
55
|
+
function deepFunction() {
|
|
56
|
+
trace("Trace from a deeply nested function.");
|
|
57
|
+
}
|
|
58
|
+
deepFunction();
|
|
59
|
+
}
|
|
60
|
+
innerFunction();
|
|
61
|
+
}
|
|
62
|
+
// Visual feature tests
|
|
63
|
+
function testBanners() {
|
|
64
|
+
demonstrateBanners();
|
|
65
|
+
}
|
|
66
|
+
function testThemes() {
|
|
67
|
+
demonstrateThemes();
|
|
68
|
+
}
|
|
69
|
+
function testSVG() {
|
|
70
|
+
demonstrateSVG();
|
|
71
|
+
}
|
|
72
|
+
function testAnimations() {
|
|
73
|
+
demonstrateAnimations();
|
|
74
|
+
}
|
|
75
|
+
function testCLI() {
|
|
76
|
+
demonstrateCLI();
|
|
77
|
+
}
|
|
78
|
+
function testExports() {
|
|
79
|
+
demonstrateExports();
|
|
80
|
+
}
|
|
81
|
+
function testAllFeatures() {
|
|
82
|
+
group("🌟 Demonstrating Core Logger Features");
|
|
83
|
+
testDebug();
|
|
84
|
+
testInfo();
|
|
85
|
+
testWarn();
|
|
86
|
+
testError();
|
|
87
|
+
testSuccess();
|
|
88
|
+
testCritical();
|
|
89
|
+
testTable();
|
|
90
|
+
testGrouping();
|
|
91
|
+
testTiming();
|
|
92
|
+
testScopedLogger();
|
|
93
|
+
testTrace();
|
|
94
|
+
groupEnd();
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
info('🎨 Running visual features demo...');
|
|
97
|
+
demoAllFeatures();
|
|
98
|
+
}, 2000);
|
|
99
|
+
}
|
|
100
|
+
// Expose functions to global scope for onclick attributes in index.html
|
|
101
|
+
if (typeof window !== 'undefined') {
|
|
102
|
+
// Core logging tests
|
|
103
|
+
window.testDebug = testDebug;
|
|
104
|
+
window.testInfo = testInfo;
|
|
105
|
+
window.testWarn = testWarn;
|
|
106
|
+
window.testError = testError;
|
|
107
|
+
window.testSuccess = testSuccess;
|
|
108
|
+
window.testCritical = testCritical;
|
|
109
|
+
window.testTable = testTable;
|
|
110
|
+
window.testGrouping = testGrouping;
|
|
111
|
+
window.testTiming = testTiming;
|
|
112
|
+
window.testScopedLogger = testScopedLogger;
|
|
113
|
+
window.testTrace = testTrace;
|
|
114
|
+
window.testAllFeatures = testAllFeatures;
|
|
115
|
+
// Visual feature tests
|
|
116
|
+
window.testBanners = testBanners;
|
|
117
|
+
window.testThemes = testThemes;
|
|
118
|
+
window.testSVG = testSVG;
|
|
119
|
+
window.testAnimations = testAnimations;
|
|
120
|
+
window.testCLI = testCLI;
|
|
121
|
+
window.testExports = testExports;
|
|
122
|
+
// Direct access to library functions
|
|
123
|
+
window.cli = cli;
|
|
124
|
+
window.setTheme = setTheme;
|
|
125
|
+
window.setBannerType = setBannerType;
|
|
126
|
+
window.showBanner = showBanner;
|
|
127
|
+
window.logWithSVG = logWithSVG;
|
|
128
|
+
window.logAnimated = logAnimated;
|
|
129
|
+
window.createStyle = createStyle;
|
|
130
|
+
window.stylePresets = stylePresets;
|
|
131
|
+
// Display welcome info
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
console.log('%c💡 Quick Start Guide', stylePresets.info);
|
|
134
|
+
console.log('🎨 Visual: testBanners(), testThemes(), testSVG(), testAnimations()');
|
|
135
|
+
console.log('📊 Core: testTable(), testGrouping(), testTiming(), testTrace()');
|
|
136
|
+
console.log('💻 CLI: cli("/help") - Try commands like "/theme neon", "/banner ascii"');
|
|
137
|
+
console.log('🌟 Full Demo: testAllFeatures()');
|
|
138
|
+
}, 1000);
|
|
139
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview StyleBuilder class for Advanced Logger
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Utility class for creating dynamic console styles with method chaining
|
|
6
|
+
*/
|
|
7
|
+
export declare class StyleBuilder {
|
|
8
|
+
private styles;
|
|
9
|
+
constructor(baseStyle?: string);
|
|
10
|
+
/**
|
|
11
|
+
* Add background color or gradient
|
|
12
|
+
*/
|
|
13
|
+
bg(background: string): StyleBuilder;
|
|
14
|
+
/**
|
|
15
|
+
* Add text color
|
|
16
|
+
*/
|
|
17
|
+
color(color: string): StyleBuilder;
|
|
18
|
+
/**
|
|
19
|
+
* Add border styling
|
|
20
|
+
*/
|
|
21
|
+
border(border: string): StyleBuilder;
|
|
22
|
+
/**
|
|
23
|
+
* Add box shadow
|
|
24
|
+
*/
|
|
25
|
+
shadow(shadow: string): StyleBuilder;
|
|
26
|
+
/**
|
|
27
|
+
* Add padding
|
|
28
|
+
*/
|
|
29
|
+
padding(padding: string): StyleBuilder;
|
|
30
|
+
/**
|
|
31
|
+
* Add margin
|
|
32
|
+
*/
|
|
33
|
+
margin(margin: string): StyleBuilder;
|
|
34
|
+
/**
|
|
35
|
+
* Add border radius
|
|
36
|
+
*/
|
|
37
|
+
rounded(radius?: string): StyleBuilder;
|
|
38
|
+
/**
|
|
39
|
+
* Add font weight
|
|
40
|
+
*/
|
|
41
|
+
bold(): StyleBuilder;
|
|
42
|
+
/**
|
|
43
|
+
* Add font styling
|
|
44
|
+
*/
|
|
45
|
+
font(font: string): StyleBuilder;
|
|
46
|
+
/**
|
|
47
|
+
* Add font size
|
|
48
|
+
*/
|
|
49
|
+
size(size: string): StyleBuilder;
|
|
50
|
+
/**
|
|
51
|
+
* Add line height
|
|
52
|
+
*/
|
|
53
|
+
lineHeight(height: string): StyleBuilder;
|
|
54
|
+
/**
|
|
55
|
+
* Add text decoration
|
|
56
|
+
*/
|
|
57
|
+
underline(): StyleBuilder;
|
|
58
|
+
/**
|
|
59
|
+
* Add text transform
|
|
60
|
+
*/
|
|
61
|
+
uppercase(): StyleBuilder;
|
|
62
|
+
/**
|
|
63
|
+
* Add opacity
|
|
64
|
+
*/
|
|
65
|
+
opacity(value: number): StyleBuilder;
|
|
66
|
+
/**
|
|
67
|
+
* Add display property
|
|
68
|
+
*/
|
|
69
|
+
display(value: string): StyleBuilder;
|
|
70
|
+
/**
|
|
71
|
+
* Add position property
|
|
72
|
+
*/
|
|
73
|
+
position(value: string): StyleBuilder;
|
|
74
|
+
/**
|
|
75
|
+
* Add transform property
|
|
76
|
+
*/
|
|
77
|
+
transform(value: string): StyleBuilder;
|
|
78
|
+
/**
|
|
79
|
+
* Add animation property
|
|
80
|
+
*/
|
|
81
|
+
animation(value: string): StyleBuilder;
|
|
82
|
+
/**
|
|
83
|
+
* Add transition property
|
|
84
|
+
*/
|
|
85
|
+
transition(value: string): StyleBuilder;
|
|
86
|
+
/**
|
|
87
|
+
* Add cursor property
|
|
88
|
+
*/
|
|
89
|
+
cursor(value: string): StyleBuilder;
|
|
90
|
+
/**
|
|
91
|
+
* Add any custom CSS property
|
|
92
|
+
*/
|
|
93
|
+
custom(property: string, value: string): StyleBuilder;
|
|
94
|
+
/**
|
|
95
|
+
* Add any CSS property (alias for custom)
|
|
96
|
+
*/
|
|
97
|
+
css(property: string, value: string): StyleBuilder;
|
|
98
|
+
/**
|
|
99
|
+
* Build the final CSS string
|
|
100
|
+
*/
|
|
101
|
+
build(): string;
|
|
102
|
+
/**
|
|
103
|
+
* Clear all styles and start fresh
|
|
104
|
+
*/
|
|
105
|
+
clear(): StyleBuilder;
|
|
106
|
+
/**
|
|
107
|
+
* Clone this StyleBuilder with the same styles
|
|
108
|
+
*/
|
|
109
|
+
clone(): StyleBuilder;
|
|
110
|
+
/**
|
|
111
|
+
* Merge another StyleBuilder's styles into this one
|
|
112
|
+
*/
|
|
113
|
+
merge(other: StyleBuilder): StyleBuilder;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Dynamic styler instance for external use
|
|
117
|
+
*/
|
|
118
|
+
export declare const $: any;
|
|
119
|
+
/**
|
|
120
|
+
* Pre-defined style presets for common use cases
|
|
121
|
+
*/
|
|
122
|
+
export declare const StylePresets: {
|
|
123
|
+
success: () => StyleBuilder;
|
|
124
|
+
error: () => StyleBuilder;
|
|
125
|
+
warning: () => StyleBuilder;
|
|
126
|
+
info: () => StyleBuilder;
|
|
127
|
+
debug: () => StyleBuilder;
|
|
128
|
+
muted: () => StyleBuilder;
|
|
129
|
+
accent: () => StyleBuilder;
|
|
130
|
+
neon: () => StyleBuilder;
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=StyleBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyleBuilder.d.ts","sourceRoot":"","sources":["../../src/styling/StyleBuilder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,MAAM,CAAgB;gBAElB,SAAS,SAAK;IAI1B;;OAEG;IACH,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY;IAKpC;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKlC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAKpC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAKpC;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IAKtC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAKpC;;OAEG;IACH,OAAO,CAAC,MAAM,GAAE,MAAc,GAAG,YAAY;IAK7C;;OAEG;IACH,IAAI,IAAI,YAAY;IAKpB;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAKhC;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAKhC;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAKxC;;OAEG;IACH,SAAS,IAAI,YAAY;IAKzB;;OAEG;IACH,SAAS,IAAI,YAAY;IAKzB;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKpC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKpC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKrC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKtC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKtC;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKvC;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAKnC;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;IAKrD;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;IAIlD;;OAEG;IACH,KAAK,IAAI,MAAM;IAIf;;OAEG;IACH,KAAK,IAAI,YAAY;IAKrB;;OAEG;IACH,KAAK,IAAI,YAAY;IAMrB;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY;CAI3C;AAqBD;;GAEG;AACH,eAAO,MAAM,CAAC,KAAiB,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;CAuDxB,CAAC"}
|