@mks2508/better-logger 0.0.2-alpha.2 → 0.3.0

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.
Files changed (326) hide show
  1. package/.claude/settings.local.json +18 -2
  2. package/.github/workflows/ci-quality.yml +357 -0
  3. package/.github/workflows/docs-demo.yml +119 -0
  4. package/.github/workflows/releases-core.yml +512 -0
  5. package/.github/workflows/releases-full.yml +582 -0
  6. package/.github/{workflows → workflows-backup}/ci.yml +12 -110
  7. package/.github/workflows-backup/nightly.yml +196 -0
  8. package/.github/workflows-backup/release-optimized.yml +373 -0
  9. package/.release-notes-0.2.0.md +129 -0
  10. package/.yamllint +28 -0
  11. package/CHANGELOG.json +783 -0
  12. package/CLAUDE.md +92 -1
  13. package/README.md +198 -490
  14. package/bun.lock +323 -0
  15. package/demo.html +9 -2
  16. package/dist/.tsbuildinfo +1 -0
  17. package/dist/Logger.d.ts +272 -0
  18. package/dist/Logger.d.ts.map +1 -0
  19. package/dist/Logger.js +680 -0
  20. package/dist/ScopedLogger.d.ts +126 -0
  21. package/dist/ScopedLogger.d.ts.map +1 -0
  22. package/dist/ScopedLogger.js +234 -0
  23. package/dist/chunks/Logger-BpeuYIxR.js +2 -0
  24. package/dist/chunks/Logger-BpeuYIxR.js.map +1 -0
  25. package/dist/chunks/Logger-Didxtr23.js +3275 -0
  26. package/dist/chunks/Logger-Didxtr23.js.map +1 -0
  27. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
  28. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
  29. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
  30. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
  31. package/dist/chunks/environment-Bxbnw4pd.js +544 -0
  32. package/dist/chunks/environment-Bxbnw4pd.js.map +1 -0
  33. package/dist/chunks/environment-Dm66zOML.js +4 -0
  34. package/dist/chunks/environment-Dm66zOML.js.map +1 -0
  35. package/dist/chunks/formatting-C0riPC5_.js +95 -0
  36. package/dist/chunks/formatting-C0riPC5_.js.map +1 -0
  37. package/dist/chunks/formatting-DNCAV66-.js +2 -0
  38. package/dist/chunks/formatting-DNCAV66-.js.map +1 -0
  39. package/dist/cli/CommandProcessor.d.ts +103 -0
  40. package/dist/cli/CommandProcessor.d.ts.map +1 -0
  41. package/dist/cli/CommandProcessor.js +184 -0
  42. package/dist/cli/commands/ConfigCommand.d.ts +17 -0
  43. package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
  44. package/dist/cli/commands/ConfigCommand.js +88 -0
  45. package/dist/cli/commands/ExportCommand.d.ts +51 -0
  46. package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
  47. package/dist/cli/commands/ExportCommand.js +243 -0
  48. package/dist/cli/commands/HistoryCommand.d.ts +50 -0
  49. package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
  50. package/dist/cli/commands/HistoryCommand.js +96 -0
  51. package/dist/cli/commands/StatusCommand.d.ts +33 -0
  52. package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
  53. package/dist/cli/commands/StatusCommand.js +93 -0
  54. package/dist/cli/commands/ThemeCommand.d.ts +33 -0
  55. package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
  56. package/dist/cli/commands/ThemeCommand.js +79 -0
  57. package/dist/cli/help.d.ts +15 -0
  58. package/dist/cli/help.d.ts.map +1 -0
  59. package/dist/cli/help.js +118 -0
  60. package/dist/cli/index.d.ts +15 -0
  61. package/dist/cli/index.d.ts.map +1 -0
  62. package/dist/cli/index.js +46 -0
  63. package/dist/constants.d.ts +122 -0
  64. package/dist/constants.d.ts.map +1 -0
  65. package/dist/constants.js +159 -0
  66. package/dist/core.cjs +1 -1
  67. package/dist/core.cjs.map +1 -1
  68. package/dist/core.d.ts +134 -0
  69. package/dist/core.d.ts.map +1 -0
  70. package/dist/core.js +315 -242
  71. package/dist/core.js.map +1 -1
  72. package/dist/example.d.ts +18 -0
  73. package/dist/example.d.ts.map +1 -0
  74. package/dist/example.js +154 -0
  75. package/dist/exports-module.d.ts +203 -0
  76. package/dist/exports-module.d.ts.map +1 -0
  77. package/dist/exports-module.js +260 -0
  78. package/dist/exports.cjs +1 -1
  79. package/dist/exports.cjs.map +1 -1
  80. package/dist/exports.js +5 -4
  81. package/dist/exports.js.map +1 -1
  82. package/dist/handlers/AnalyticsLogHandler.d.ts +11 -0
  83. package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  84. package/dist/handlers/AnalyticsLogHandler.js +19 -0
  85. package/dist/handlers/ExportLogHandler.d.ts +103 -0
  86. package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
  87. package/dist/handlers/ExportLogHandler.js +516 -0
  88. package/dist/handlers/FileLogHandler.d.ts +36 -0
  89. package/dist/handlers/FileLogHandler.d.ts.map +1 -0
  90. package/dist/handlers/FileLogHandler.js +156 -0
  91. package/dist/handlers/RemoteLogHandler.d.ts +14 -0
  92. package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
  93. package/dist/handlers/RemoteLogHandler.js +37 -0
  94. package/dist/handlers/index.d.ts +8 -0
  95. package/dist/handlers/index.d.ts.map +1 -0
  96. package/dist/handlers/index.js +7 -0
  97. package/dist/index.cjs +1 -1
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.d.ts +86 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +89 -103
  102. package/dist/index.js.map +1 -1
  103. package/dist/main.d.ts +2 -0
  104. package/dist/main.d.ts.map +1 -0
  105. package/dist/main.js +139 -0
  106. package/dist/styling/LogStyleBuilder.d.ts +149 -0
  107. package/dist/styling/LogStyleBuilder.d.ts.map +1 -0
  108. package/dist/styling/LogStyleBuilder.js +289 -0
  109. package/dist/styling/SemanticStyles.d.ts +181 -0
  110. package/dist/styling/SemanticStyles.d.ts.map +1 -0
  111. package/dist/styling/SemanticStyles.js +339 -0
  112. package/dist/styling/SmartPresets.d.ts +25 -0
  113. package/dist/styling/SmartPresets.d.ts.map +1 -0
  114. package/dist/styling/SmartPresets.js +276 -0
  115. package/dist/styling/StyleBuilder.d.ts +140 -0
  116. package/dist/styling/StyleBuilder.d.ts.map +1 -0
  117. package/dist/styling/StyleBuilder.js +280 -0
  118. package/dist/styling/banners.d.ts +45 -0
  119. package/dist/styling/banners.d.ts.map +1 -0
  120. package/dist/styling/banners.js +155 -0
  121. package/dist/styling/index.d.ts +10 -0
  122. package/dist/styling/index.d.ts.map +1 -0
  123. package/dist/styling/index.js +9 -0
  124. package/dist/styling/themes.d.ts +10 -0
  125. package/dist/styling/themes.d.ts.map +1 -0
  126. package/dist/styling/themes.js +231 -0
  127. package/dist/styling-module.d.ts +185 -0
  128. package/dist/styling-module.d.ts.map +1 -0
  129. package/dist/styling-module.js +199 -0
  130. package/dist/styling.cjs +1 -1
  131. package/dist/styling.cjs.map +1 -1
  132. package/dist/styling.js +6 -6
  133. package/dist/styling.js.map +1 -1
  134. package/dist/types/Logger.d.ts +268 -0
  135. package/dist/types/Logger.d.ts.map +1 -0
  136. package/dist/types/ScopedLogger.d.ts +123 -0
  137. package/dist/types/ScopedLogger.d.ts.map +1 -0
  138. package/dist/types/cli/CommandProcessor.d.ts +100 -0
  139. package/dist/types/cli/CommandProcessor.d.ts.map +1 -0
  140. package/dist/types/cli/commands/ConfigCommand.d.ts +14 -0
  141. package/dist/types/cli/commands/ConfigCommand.d.ts.map +1 -0
  142. package/dist/types/cli/commands/ExportCommand.d.ts +48 -0
  143. package/dist/types/cli/commands/ExportCommand.d.ts.map +1 -0
  144. package/dist/types/cli/commands/HistoryCommand.d.ts +47 -0
  145. package/dist/types/cli/commands/HistoryCommand.d.ts.map +1 -0
  146. package/dist/types/cli/commands/StatusCommand.d.ts +30 -0
  147. package/dist/types/cli/commands/StatusCommand.d.ts.map +1 -0
  148. package/dist/types/cli/commands/ThemeCommand.d.ts +30 -0
  149. package/dist/types/cli/commands/ThemeCommand.d.ts.map +1 -0
  150. package/dist/types/cli/help.d.ts +12 -0
  151. package/dist/types/cli/help.d.ts.map +1 -0
  152. package/dist/types/cli/index.d.ts +15 -0
  153. package/dist/types/cli/index.d.ts.map +1 -0
  154. package/dist/types/constants.d.ts +119 -0
  155. package/dist/types/constants.d.ts.map +1 -0
  156. package/dist/types/core.d.ts +125 -211
  157. package/dist/types/core.d.ts.map +1 -0
  158. package/dist/types/core.js +13 -0
  159. package/dist/types/example.d.ts +18 -0
  160. package/dist/types/example.d.ts.map +1 -0
  161. package/dist/types/exports-module.d.ts +196 -0
  162. package/dist/types/exports-module.d.ts.map +1 -0
  163. package/dist/types/handlers/AnalyticsLogHandler.d.ts +8 -0
  164. package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  165. package/dist/types/handlers/ExportLogHandler.d.ts +100 -0
  166. package/dist/types/handlers/ExportLogHandler.d.ts.map +1 -0
  167. package/dist/types/handlers/FileLogHandler.d.ts +33 -0
  168. package/dist/types/handlers/FileLogHandler.d.ts.map +1 -0
  169. package/dist/types/handlers/RemoteLogHandler.d.ts +11 -0
  170. package/dist/types/handlers/RemoteLogHandler.d.ts.map +1 -0
  171. package/dist/types/handlers/index.d.ts +8 -0
  172. package/dist/types/handlers/index.d.ts.map +1 -0
  173. package/dist/types/handlers.d.ts +88 -0
  174. package/dist/types/handlers.d.ts.map +1 -0
  175. package/dist/types/handlers.js +4 -0
  176. package/dist/types/index.d.ts +7 -675
  177. package/dist/types/index.d.ts.map +1 -0
  178. package/dist/types/index.js +4 -0
  179. package/dist/types/main.d.ts +2 -0
  180. package/dist/types/main.d.ts.map +1 -0
  181. package/dist/types/styling/LogStyleBuilder.d.ts +146 -0
  182. package/dist/types/styling/LogStyleBuilder.d.ts.map +1 -0
  183. package/dist/types/styling/SemanticStyles.d.ts +178 -0
  184. package/dist/types/styling/SemanticStyles.d.ts.map +1 -0
  185. package/dist/types/styling/SmartPresets.d.ts +22 -0
  186. package/dist/types/styling/SmartPresets.d.ts.map +1 -0
  187. package/dist/types/styling/StyleBuilder.d.ts +140 -0
  188. package/dist/types/styling/StyleBuilder.d.ts.map +1 -0
  189. package/dist/types/styling/banners.d.ts +42 -0
  190. package/dist/types/styling/banners.d.ts.map +1 -0
  191. package/dist/types/styling/index.d.ts +10 -0
  192. package/dist/types/styling/index.d.ts.map +1 -0
  193. package/dist/types/styling/themes.d.ts +7 -0
  194. package/dist/types/styling/themes.d.ts.map +1 -0
  195. package/dist/types/styling-module.d.ts +178 -0
  196. package/dist/types/styling-module.d.ts.map +1 -0
  197. package/dist/types/types/core.d.ts +125 -0
  198. package/dist/types/types/core.d.ts.map +1 -0
  199. package/dist/types/types/handlers.d.ts +85 -0
  200. package/dist/types/types/handlers.d.ts.map +1 -0
  201. package/dist/types/types/index.d.ts +7 -0
  202. package/dist/types/types/index.d.ts.map +1 -0
  203. package/dist/types/utils/environment.d.ts +47 -0
  204. package/dist/types/utils/environment.d.ts.map +1 -0
  205. package/dist/types/utils/formatting.d.ts +37 -0
  206. package/dist/types/utils/formatting.d.ts.map +1 -0
  207. package/dist/types/utils/index.d.ts +7 -0
  208. package/dist/types/utils/index.d.ts.map +1 -0
  209. package/dist/types/utils/opentui-detection.d.ts +34 -0
  210. package/dist/types/utils/opentui-detection.d.ts.map +1 -0
  211. package/dist/types/utils/output.d.ts +41 -0
  212. package/dist/types/utils/output.d.ts.map +1 -0
  213. package/dist/types/utils/stackTrace.d.ts +6 -0
  214. package/dist/types/utils/stackTrace.d.ts.map +1 -0
  215. package/dist/types/utils/timestamps.d.ts +20 -0
  216. package/dist/types/utils/timestamps.d.ts.map +1 -0
  217. package/dist/utils/environment.d.ts +47 -0
  218. package/dist/utils/environment.d.ts.map +1 -0
  219. package/dist/utils/environment.js +85 -0
  220. package/dist/utils/formatting.d.ts +40 -0
  221. package/dist/utils/formatting.d.ts.map +1 -0
  222. package/dist/utils/formatting.js +117 -0
  223. package/dist/utils/index.d.ts +7 -0
  224. package/dist/utils/index.d.ts.map +1 -0
  225. package/dist/utils/index.js +6 -0
  226. package/dist/utils/opentui-detection.d.ts +34 -0
  227. package/dist/utils/opentui-detection.d.ts.map +1 -0
  228. package/dist/utils/opentui-detection.js +116 -0
  229. package/dist/utils/output.d.ts +44 -0
  230. package/dist/utils/output.d.ts.map +1 -0
  231. package/dist/utils/output.js +150 -0
  232. package/dist/utils/stackTrace.d.ts +9 -0
  233. package/dist/utils/stackTrace.d.ts.map +1 -0
  234. package/dist/utils/stackTrace.js +81 -0
  235. package/dist/utils/timestamps.d.ts +20 -0
  236. package/dist/utils/timestamps.d.ts.map +1 -0
  237. package/dist/utils/timestamps.js +71 -0
  238. package/docs/API.md +691 -0
  239. package/docs/CORE.md +10 -10
  240. package/docs/DEVELOPMENT.md +731 -0
  241. package/docs/PACKAGES.md +244 -0
  242. package/docs/_config.yml +36 -0
  243. package/docs/index.md +179 -0
  244. package/examples/README.md +208 -0
  245. package/examples/basic-logging.js +75 -0
  246. package/examples/data-export.js +234 -0
  247. package/examples/package.json +16 -0
  248. package/examples/performance-timing.js +170 -0
  249. package/examples/simplified-api.js +124 -0
  250. package/examples/styling-themes.js +207 -0
  251. package/package.json +37 -21
  252. package/packages/core/package.json +57 -0
  253. package/packages/exports/package.json +41 -0
  254. package/packages/nodejs-opentui/README.md +232 -0
  255. package/packages/nodejs-opentui/package.json +72 -0
  256. package/packages/nodejs-opentui/src/LogRenderer.ts +171 -0
  257. package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +178 -0
  258. package/packages/nodejs-opentui/src/components/LogBadge.tsx +131 -0
  259. package/packages/nodejs-opentui/src/index.ts +133 -0
  260. package/packages/nodejs-opentui/src/types.ts +158 -0
  261. package/packages/nodejs-opentui/tsconfig.json +20 -0
  262. package/packages/styling/package.json +41 -0
  263. package/project-utils/README.md +172 -0
  264. package/project-utils/auto-release-gemini.ts +1193 -0
  265. package/project-utils/auto-release-ui.ts +1329 -0
  266. package/project-utils/commit-generator.ts +1385 -0
  267. package/project-utils/commit-ui.ts +264 -0
  268. package/project-utils/git-utils.ts +199 -0
  269. package/project-utils/github-release-manager.ts +466 -0
  270. package/project-utils/project-config.ts +260 -0
  271. package/project-utils/prompt-templates.js +345 -0
  272. package/project-utils/prompt-templates.ts +422 -0
  273. package/project-utils/version-manager.ts +1078 -0
  274. package/src/Logger.ts +251 -16
  275. package/src/ScopedLogger.ts +262 -0
  276. package/src/cli/CommandProcessor.ts +173 -2
  277. package/src/cli/commands/HistoryCommand.ts +117 -0
  278. package/src/cli/index.ts +12 -0
  279. package/src/constants.ts +84 -2
  280. package/src/core.ts +119 -46
  281. package/src/example.ts +4 -4
  282. package/src/exports-module.ts +1 -1
  283. package/src/handlers/ExportLogHandler.ts +141 -0
  284. package/src/handlers/FileLogHandler.ts +144 -5
  285. package/src/index.ts +1 -1
  286. package/src/main.ts +3 -3
  287. package/src/styling/LogStyleBuilder.ts +355 -0
  288. package/src/styling/SemanticStyles.ts +380 -0
  289. package/src/styling/SmartPresets.ts +288 -0
  290. package/src/styling/StyleBuilder.ts +14 -0
  291. package/src/styling/index.ts +16 -1
  292. package/src/styling-module.ts +1 -1
  293. package/src/types/core.ts +60 -0
  294. package/src/types/index.ts +6 -0
  295. package/src/utils/environment.ts +94 -0
  296. package/src/utils/formatting.ts +142 -0
  297. package/src/utils/index.ts +3 -0
  298. package/src/utils/opentui-detection.ts +138 -0
  299. package/src/utils/output.ts +66 -8
  300. package/test-core-browser.html +237 -0
  301. package/test-core-node.js +63 -0
  302. package/tests/test-conflict-resolution.ts +391 -0
  303. package/tests/validate-workflows.sh +131 -0
  304. package/tests/yaml-autofix.sh +146 -0
  305. package/vite.config.ts +189 -50
  306. package/.npmrc.bak +0 -1
  307. package/dist/chunks/Logger-BQhMKy_T.js +0 -2
  308. package/dist/chunks/Logger-BQhMKy_T.js.map +0 -1
  309. package/dist/chunks/Logger-BrFKFZcD.js +0 -978
  310. package/dist/chunks/Logger-BrFKFZcD.js.map +0 -1
  311. package/dist/chunks/core-2opW4Pi3.js +0 -194
  312. package/dist/chunks/core-2opW4Pi3.js.map +0 -1
  313. package/dist/chunks/core-DyugwSYZ.js +0 -4
  314. package/dist/chunks/core-DyugwSYZ.js.map +0 -1
  315. package/dist/chunks/exports-BNP3R7dp.js +0 -421
  316. package/dist/chunks/exports-BNP3R7dp.js.map +0 -1
  317. package/dist/chunks/exports-U1xLBXrY.js +0 -2
  318. package/dist/chunks/exports-U1xLBXrY.js.map +0 -1
  319. package/dist/chunks/styling-DhUDzwlE.js +0 -654
  320. package/dist/chunks/styling-DhUDzwlE.js.map +0 -1
  321. package/dist/chunks/styling-tmRDI28D.js +0 -2
  322. package/dist/chunks/styling-tmRDI28D.js.map +0 -1
  323. package/dist/types/exports.d.ts +0 -600
  324. package/dist/types/styling.d.ts +0 -751
  325. package/src/Logger.ts.backup +0 -1684
  326. /package/.github/{workflows → workflows-backup}/release.yml +0 -0
@@ -0,0 +1,288 @@
1
+ /**
2
+ * @fileoverview Smart presets for simplified logger configuration
3
+ */
4
+
5
+ import type { LogStyles, LogLayout } from '../types/index.js';
6
+
7
+ /**
8
+ * Smart presets that configure the entire log appearance
9
+ */
10
+ export const SMART_PRESETS: Record<string, LogStyles> = {
11
+ /**
12
+ * Default preset - works perfectly out-of-the-box
13
+ * Clean, readable, automatically adaptive to dark/light themes
14
+ */
15
+ default: {
16
+ layout: {
17
+ spacing: 'normal',
18
+ innerPadding: '2px',
19
+ outerMargin: '1px'
20
+ },
21
+ timestamp: {
22
+ show: true,
23
+ color: 'auto', // Automatically adaptive
24
+ font: 'Monaco, Consolas, monospace',
25
+ size: '11px'
26
+ },
27
+ level: {
28
+ show: true,
29
+ style: 'badge',
30
+ uppercase: false,
31
+ padding: '2px 8px'
32
+ },
33
+ prefix: {
34
+ show: true,
35
+ style: 'dark', // Automatically adaptive
36
+ padding: '2px 6px'
37
+ },
38
+ message: {
39
+ show: true,
40
+ color: 'auto', // Automatically adaptive
41
+ font: 'system-ui, -apple-system, sans-serif',
42
+ size: '14px'
43
+ },
44
+ location: {
45
+ show: true,
46
+ color: 'auto', // Automatically adaptive
47
+ font: 'Monaco, Consolas, monospace',
48
+ size: '11px'
49
+ }
50
+ },
51
+
52
+ /**
53
+ * Cyberpunk preset - neon colors, glowing effects, dark theme
54
+ */
55
+ cyberpunk: {
56
+ layout: {
57
+ spacing: 'compact',
58
+ innerPadding: '1px',
59
+ outerMargin: '0px'
60
+ },
61
+ timestamp: {
62
+ show: true,
63
+ color: '#00ffff',
64
+ font: 'Monaco, Consolas, monospace',
65
+ size: '10px',
66
+ style: 'neon'
67
+ },
68
+ level: {
69
+ show: true,
70
+ style: 'glowing',
71
+ uppercase: true,
72
+ padding: '2px 8px'
73
+ },
74
+ prefix: {
75
+ show: true,
76
+ color: '#ff0080',
77
+ background: 'rgba(255, 0, 128, 0.1)',
78
+ border: '1px solid #ff0080',
79
+ style: 'neon'
80
+ },
81
+ message: {
82
+ show: true,
83
+ color: '#00ff41',
84
+ font: 'Monaco, Consolas, monospace',
85
+ size: '13px'
86
+ },
87
+ location: {
88
+ show: false // Hidden for cleaner look
89
+ },
90
+ backdrop: 'blur(2px)',
91
+ transparency: 0.9
92
+ },
93
+
94
+ /**
95
+ * Glassmorphism preset - modern blur effects, transparency
96
+ */
97
+ glassmorphism: {
98
+ layout: {
99
+ spacing: 'spacious',
100
+ innerPadding: '4px',
101
+ outerMargin: '2px'
102
+ },
103
+ timestamp: {
104
+ show: true,
105
+ color: 'auto',
106
+ font: 'system-ui, sans-serif',
107
+ size: '11px',
108
+ style: 'glassmorphic'
109
+ },
110
+ level: {
111
+ show: true,
112
+ style: 'glassmorphic',
113
+ uppercase: false,
114
+ padding: '4px 12px'
115
+ },
116
+ prefix: {
117
+ show: true,
118
+ style: 'glassmorphic',
119
+ padding: '3px 8px'
120
+ },
121
+ message: {
122
+ show: true,
123
+ color: 'auto',
124
+ font: 'system-ui, sans-serif',
125
+ size: '14px'
126
+ },
127
+ location: {
128
+ show: true,
129
+ color: 'auto',
130
+ font: 'system-ui, sans-serif',
131
+ size: '11px',
132
+ style: 'glassmorphic'
133
+ },
134
+ backdrop: 'blur(10px)',
135
+ transparency: 0.8
136
+ },
137
+
138
+ /**
139
+ * Minimal preset - clean, no decorations, maximum readability
140
+ */
141
+ minimal: {
142
+ layout: {
143
+ spacing: 'compact',
144
+ innerPadding: '0px',
145
+ outerMargin: '0px'
146
+ },
147
+ timestamp: {
148
+ show: false // Hidden for minimal look
149
+ },
150
+ level: {
151
+ show: true,
152
+ style: 'flat',
153
+ uppercase: true,
154
+ padding: '0px 4px',
155
+ border: 'none',
156
+ background: 'transparent'
157
+ },
158
+ prefix: {
159
+ show: true,
160
+ style: 'flat',
161
+ padding: '0px 4px',
162
+ border: 'none',
163
+ background: 'transparent'
164
+ },
165
+ message: {
166
+ show: true,
167
+ color: 'auto',
168
+ font: 'system-ui, sans-serif',
169
+ size: '14px'
170
+ },
171
+ location: {
172
+ show: false // Hidden for minimal look
173
+ }
174
+ },
175
+
176
+ /**
177
+ * Debug preset - monospace, detailed, compact for development
178
+ */
179
+ debug: {
180
+ layout: {
181
+ spacing: 'compact',
182
+ innerPadding: '1px',
183
+ outerMargin: '0px'
184
+ },
185
+ timestamp: {
186
+ show: true,
187
+ color: 'auto',
188
+ font: 'Monaco, Consolas, monospace',
189
+ size: '10px'
190
+ },
191
+ level: {
192
+ show: true,
193
+ style: 'compact',
194
+ uppercase: true,
195
+ padding: '1px 4px',
196
+ font: 'Monaco, Consolas, monospace',
197
+ size: '10px'
198
+ },
199
+ prefix: {
200
+ show: true,
201
+ style: 'compact',
202
+ padding: '1px 4px',
203
+ font: 'Monaco, Consolas, monospace',
204
+ size: '10px'
205
+ },
206
+ message: {
207
+ show: true,
208
+ color: 'auto',
209
+ font: 'Monaco, Consolas, monospace',
210
+ size: '12px'
211
+ },
212
+ location: {
213
+ show: true,
214
+ color: 'auto',
215
+ font: 'Monaco, Consolas, monospace',
216
+ size: '10px',
217
+ style: 'clickable'
218
+ }
219
+ },
220
+
221
+ /**
222
+ * Production preset - clean, essential info only
223
+ */
224
+ production: {
225
+ layout: {
226
+ spacing: 'normal',
227
+ innerPadding: '2px',
228
+ outerMargin: '1px'
229
+ },
230
+ timestamp: {
231
+ show: true,
232
+ color: 'auto',
233
+ font: 'system-ui, sans-serif',
234
+ size: '11px'
235
+ },
236
+ level: {
237
+ show: true,
238
+ style: 'badge',
239
+ uppercase: false,
240
+ padding: '2px 6px'
241
+ },
242
+ prefix: {
243
+ show: false // Hidden in production
244
+ },
245
+ message: {
246
+ show: true,
247
+ color: 'auto',
248
+ font: 'system-ui, sans-serif',
249
+ size: '14px'
250
+ },
251
+ location: {
252
+ show: false // Hidden in production
253
+ }
254
+ }
255
+ };
256
+
257
+ /**
258
+ * Get a smart preset by name
259
+ */
260
+ export function getSmartPreset(name: string): LogStyles | null {
261
+ return SMART_PRESETS[name] || null;
262
+ }
263
+
264
+ /**
265
+ * List all available smart presets
266
+ */
267
+ export function getAvailablePresets(): string[] {
268
+ return Object.keys(SMART_PRESETS);
269
+ }
270
+
271
+ /**
272
+ * Check if a preset exists
273
+ */
274
+ export function hasPreset(name: string): boolean {
275
+ return name in SMART_PRESETS;
276
+ }
277
+
278
+ /**
279
+ * Preset descriptions for help/documentation
280
+ */
281
+ export const PRESET_DESCRIPTIONS: Record<string, string> = {
282
+ default: 'Clean, readable, automatically adaptive to dark/light themes',
283
+ cyberpunk: 'Neon colors, glowing effects, perfect for dark themes',
284
+ glassmorphism: 'Modern blur effects with transparency and spacious layout',
285
+ minimal: 'Clean and simple, no decorations, maximum readability',
286
+ debug: 'Monospace fonts, detailed info, compact layout for development',
287
+ production: 'Professional look with essential information only'
288
+ };
@@ -84,6 +84,20 @@ export class StyleBuilder {
84
84
  return this;
85
85
  }
86
86
 
87
+ /**
88
+ * Set monospace font family (alias for common monospace fonts)
89
+ */
90
+ mono(): StyleBuilder {
91
+ return this.font('Monaco, Consolas, "Courier New", monospace');
92
+ }
93
+
94
+ /**
95
+ * Set system font family (alias for system fonts)
96
+ */
97
+ system(): StyleBuilder {
98
+ return this.font('system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif');
99
+ }
100
+
87
101
  /**
88
102
  * Add font size
89
103
  */
@@ -9,4 +9,19 @@ export {
9
9
  THEME_BANNERS,
10
10
  detectBannerCapabilities,
11
11
  displayInitBanner
12
- } from './banners.js';
12
+ } from './banners.js';
13
+ export {
14
+ TimestampStyler,
15
+ LevelStyler,
16
+ PrefixStyler,
17
+ MessageStyler,
18
+ LocationStyler
19
+ } from './SemanticStyles.js';
20
+ export { LogStyleBuilder, createLogStyleBuilder } from './LogStyleBuilder.js';
21
+ export {
22
+ SMART_PRESETS,
23
+ getSmartPreset,
24
+ getAvailablePresets,
25
+ hasPreset,
26
+ PRESET_DESCRIPTIONS
27
+ } from './SmartPresets.js';
@@ -214,7 +214,7 @@ export const groupEnd = () => styledLogger.groupEnd();
214
214
  export const time = (label: string) => styledLogger.time(label);
215
215
  export const timeEnd = (label: string) => styledLogger.timeEnd(label);
216
216
  export const setGlobalPrefix = (prefix: string) => styledLogger.setGlobalPrefix(prefix);
217
- export const createScopedLogger = (prefix: string) => styledLogger.createScopedLogger(prefix);
217
+ export const scope = (prefix: string) => styledLogger.scope(prefix);
218
218
  export const setVerbosity = (level: any) => styledLogger.setVerbosity(level);
219
219
  export const setTheme = (theme: ThemeVariant) => styledLogger.setTheme(theme);
220
220
  export const setBannerType = (bannerType: BannerType) => styledLogger.setBannerType(bannerType);
package/src/types/core.ts CHANGED
@@ -28,6 +28,11 @@ export type Verbosity = LogLevel | 'silent';
28
28
  */
29
29
  export type ThemeVariant = 'default' | 'dark' | 'light' | 'neon' | 'minimal' | 'cyberpunk';
30
30
 
31
+ /**
32
+ * DevTools theme detection
33
+ */
34
+ export type DevToolsTheme = 'light' | 'dark';
35
+
31
36
  /**
32
37
  * Banner types for different visual approaches
33
38
  */
@@ -50,6 +55,7 @@ export interface LoggerConfig {
50
55
  theme?: ThemeVariant;
51
56
  bannerType?: BannerType;
52
57
  bufferSize?: number;
58
+ autoDetectTheme?: boolean;
53
59
  }
54
60
 
55
61
  /**
@@ -77,4 +83,58 @@ export interface StyleOptions {
77
83
  width?: number;
78
84
  height?: number;
79
85
  padding?: string;
86
+ }
87
+
88
+ /**
89
+ * Adaptive color configuration for light/dark themes
90
+ */
91
+ export interface AdaptiveColors {
92
+ light: string;
93
+ dark: string;
94
+ }
95
+
96
+ /**
97
+ * Spacing configuration for log elements
98
+ */
99
+ export type SpacingType = 'compact' | 'normal' | 'spacious';
100
+
101
+ /**
102
+ * Layout configuration for log structure
103
+ */
104
+ export interface LogLayout {
105
+ spacing: SpacingType;
106
+ innerPadding?: string;
107
+ outerMargin?: string;
108
+ separator?: string;
109
+ }
110
+
111
+ /**
112
+ * Configuration for individual log parts
113
+ */
114
+ export interface LogPartConfig {
115
+ show?: boolean;
116
+ style?: string;
117
+ font?: string;
118
+ size?: string;
119
+ color?: string; // Automatically adaptive by default
120
+ background?: string;
121
+ padding?: string;
122
+ margin?: string;
123
+ border?: string;
124
+ shadow?: string;
125
+ uppercase?: boolean;
126
+ }
127
+
128
+ /**
129
+ * Complete log styles configuration
130
+ */
131
+ export interface LogStyles {
132
+ layout?: LogLayout;
133
+ timestamp?: LogPartConfig;
134
+ level?: LogPartConfig;
135
+ prefix?: LogPartConfig;
136
+ message?: LogPartConfig;
137
+ location?: LogPartConfig;
138
+ backdrop?: string;
139
+ transparency?: number;
80
140
  }
@@ -7,12 +7,18 @@ export type {
7
7
  LogLevel,
8
8
  Verbosity,
9
9
  ThemeVariant,
10
+ DevToolsTheme,
10
11
  BannerType,
11
12
  ExportFormat,
12
13
  LoggerConfig,
13
14
  StackInfo,
14
15
  TimerEntry,
15
16
  StyleOptions,
17
+ AdaptiveColors,
18
+ SpacingType,
19
+ LogLayout,
20
+ LogPartConfig,
21
+ LogStyles,
16
22
  } from './core.js';
17
23
 
18
24
  export { LOG_LEVELS } from './core.js';
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @fileoverview Environment detection utilities for Universal Logger
3
+ */
4
+
5
+ /**
6
+ * Checks if running in Node.js environment
7
+ */
8
+ export const isNode = typeof process !== 'undefined' &&
9
+ process.versions &&
10
+ process.versions.node;
11
+
12
+ /**
13
+ * Checks if running in browser environment
14
+ */
15
+ export const isBrowser = typeof window !== 'undefined' &&
16
+ typeof document !== 'undefined';
17
+
18
+ /**
19
+ * Checks if running in web worker environment
20
+ */
21
+ export const isWebWorker = typeof self !== 'undefined' &&
22
+ typeof (self as any).importScripts === 'function';
23
+
24
+ /**
25
+ * Checks if running in Deno environment
26
+ */
27
+ export const isDeno = typeof globalThis !== 'undefined' &&
28
+ 'Deno' in globalThis;
29
+
30
+ /**
31
+ * Gets the current runtime environment
32
+ */
33
+ export function getRuntimeEnvironment(): 'node' | 'browser' | 'webworker' | 'deno' | 'unknown' {
34
+ if (isNode) return 'node';
35
+ if (isBrowser) return 'browser';
36
+ if (isWebWorker) return 'webworker';
37
+ if (isDeno) return 'deno';
38
+ return 'unknown';
39
+ }
40
+
41
+ /**
42
+ * Checks if colors/styling should be supported in current environment
43
+ */
44
+ export function supportsColors(): boolean {
45
+ if (isBrowser) {
46
+ // Browser always supports CSS colors
47
+ return true;
48
+ }
49
+
50
+ if (isNode) {
51
+ // Check if Node.js supports colors
52
+ return process.stdout?.isTTY === true ||
53
+ process.env.FORCE_COLOR === '1' ||
54
+ process.env.FORCE_COLOR === 'true';
55
+ }
56
+
57
+ return false;
58
+ }
59
+
60
+ /**
61
+ * Checks if CSS styling is supported (browser-only feature)
62
+ */
63
+ export function supportsCSSColors(): boolean {
64
+ return isBrowser;
65
+ }
66
+
67
+ /**
68
+ * Checks if ANSI colors are supported (terminal environments)
69
+ */
70
+ export function supportsANSIColors(): boolean {
71
+ if (isNode) {
72
+ return process.stdout?.isTTY === true ||
73
+ process.env.FORCE_COLOR === '1' ||
74
+ process.env.FORCE_COLOR === 'true';
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Gets environment-specific information
82
+ */
83
+ export function getEnvironmentInfo() {
84
+ const env = getRuntimeEnvironment();
85
+
86
+ return {
87
+ runtime: env,
88
+ supportsColors: supportsColors(),
89
+ supportsCSSColors: supportsCSSColors(),
90
+ supportsANSIColors: supportsANSIColors(),
91
+ isProduction: isNode ? process.env.NODE_ENV === 'production' : false,
92
+ version: isNode ? process.versions.node : (isBrowser ? navigator.userAgent : 'unknown')
93
+ };
94
+ }
@@ -0,0 +1,142 @@
1
+ /**
2
+ * @fileoverview Formatting utilities for Universal Logger
3
+ */
4
+
5
+ import type { LogLevel, StackInfo } from '../types/index.js';
6
+ import { formatTimestamp } from './timestamps.js';
7
+
8
+ /**
9
+ * Creates plain text output for any environment
10
+ * No colors, no styling - maximum compatibility
11
+ */
12
+ export function createPlainOutput(
13
+ level: LogLevel,
14
+ message: string,
15
+ prefix?: string,
16
+ stackInfo?: StackInfo | null
17
+ ): string {
18
+ const timestamp = formatTimestamp();
19
+ const timeStr = timestamp.slice(11, 23); // HH:MM:SS.mmm
20
+
21
+ let output = `[${timeStr}] [${level.toUpperCase()}]`;
22
+
23
+ if (prefix) {
24
+ output += ` [${prefix}]`;
25
+ }
26
+
27
+ output += ` ${message}`;
28
+
29
+ if (stackInfo) {
30
+ output += ` (${stackInfo.file}:${stackInfo.line}:${stackInfo.column})`;
31
+ }
32
+
33
+ return output;
34
+ }
35
+
36
+ /**
37
+ * Gets the appropriate log method for the level
38
+ * Uses different console methods for better semantics
39
+ */
40
+ export function getConsoleMethod(level: LogLevel): 'log' | 'info' | 'warn' | 'error' {
41
+ switch (level) {
42
+ case 'debug':
43
+ return 'log';
44
+ case 'info':
45
+ return 'info';
46
+ case 'warn':
47
+ return 'warn';
48
+ case 'error':
49
+ case 'critical':
50
+ return 'error';
51
+ default:
52
+ return 'log';
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Create a simple log entry object for handlers
58
+ */
59
+ export function createLogEntry(
60
+ level: LogLevel,
61
+ message: string,
62
+ args: any[],
63
+ prefix?: string,
64
+ stackInfo?: StackInfo | null
65
+ ) {
66
+ return {
67
+ timestamp: formatTimestamp(),
68
+ level: level.toUpperCase(),
69
+ prefix,
70
+ message,
71
+ args: args.slice(1), // Exclude the first message argument
72
+ location: stackInfo ? {
73
+ file: stackInfo.file,
74
+ line: stackInfo.line,
75
+ column: stackInfo.column,
76
+ function: stackInfo.function
77
+ } : undefined,
78
+ raw: args
79
+ };
80
+ }
81
+
82
+ /**
83
+ * Format data for table display in plain text
84
+ */
85
+ export function formatTablePlain(data: any, columns?: string[]): string {
86
+ try {
87
+ if (Array.isArray(data)) {
88
+ if (data.length === 0) return '[Empty Array]';
89
+
90
+ // Simple array formatting
91
+ if (typeof data[0] !== 'object') {
92
+ return data.map((item, i) => `${i}: ${item}`).join('\n');
93
+ }
94
+
95
+ // Object array formatting
96
+ const keys = columns || Object.keys(data[0] || {});
97
+ const header = keys.join('\t');
98
+ const rows = data.map(item =>
99
+ keys.map(key => String(item[key] || '')).join('\t')
100
+ );
101
+
102
+ return [header, ...rows].join('\n');
103
+ }
104
+
105
+ if (typeof data === 'object' && data !== null) {
106
+ // Simple object formatting
107
+ return Object.entries(data)
108
+ .map(([key, value]) => `${key}: ${value}`)
109
+ .join('\n');
110
+ }
111
+
112
+ return String(data);
113
+ } catch (error) {
114
+ return `[Error formatting table: ${error}]`;
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Safe object serialization for logging
120
+ */
121
+ export function safeSerialize(obj: any, maxDepth: number = 3, currentDepth: number = 0): any {
122
+ if (currentDepth >= maxDepth) {
123
+ return '[Max Depth Reached]';
124
+ }
125
+
126
+ if (obj === null) return null;
127
+ if (obj === undefined) return '[undefined]';
128
+ if (typeof obj === 'function') return '[Function]';
129
+ if (obj instanceof Error) return `[Error: ${obj.message}]`;
130
+ if (obj instanceof Date) return obj.toISOString();
131
+ if (typeof obj !== 'object') return obj;
132
+
133
+ if (Array.isArray(obj)) {
134
+ return obj.map(item => safeSerialize(item, maxDepth, currentDepth + 1));
135
+ }
136
+
137
+ const result: any = {};
138
+ for (const [key, value] of Object.entries(obj)) {
139
+ result[key] = safeSerialize(value, maxDepth, currentDepth + 1);
140
+ }
141
+ return result;
142
+ }
@@ -14,5 +14,8 @@ export {
14
14
  generateLogId,
15
15
  escapeHtml,
16
16
  safeStringify,
17
+ detectDevToolsTheme,
18
+ getAdaptiveColor,
19
+ setupThemeChangeListener,
17
20
  type LevelStyleConfig
18
21
  } from './output.js';