Skip to content

Commit

Permalink
Merge branch 'release/v0.25.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Nov 7, 2024
2 parents 0e21f3b + 5dab1e7 commit be05149
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeed",
"type": "module",
"version": "0.25.8",
"version": "0.25.9",
"description": "🌱 Simple foundation library",
"author": {
"name": "Dirk Holtwick",
Expand Down Expand Up @@ -71,17 +71,17 @@
"devDependencies": {
"@antfu/eslint-config": "^3.8",
"@antfu/ni": "^0.23.0",
"@types/node": "^22.8.1",
"@types/node": "^22.9.0",
"@vitejs/plugin-vue": "^5.1.4",
"@vitest/browser": "^2.1.3",
"@vitest/coverage-v8": "^2.1.3",
"@vitest/browser": "^2.1.4",
"@vitest/coverage-v8": "^2.1.4",
"esbuild": "^0.24.0",
"eslint": "^9",
"playwright": "^1.48.2",
"tsup": "^8.3.5",
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vitest": "^2.1.3"
"vitest": "^2.1.4"
},
"pnpm": {
"overrides": {
Expand Down
8 changes: 5 additions & 3 deletions src/browser/log/log-browser-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo,
import { browserSelectColorByName } from '../../common/log/log-colors'
import { getGlobalConsole } from '../../common/log/log-console-original'
import { parseLogLevel, useNamespaceFilter } from '../../common/log/log-filter'
import { getLocalStorage } from '../../common/platform'
import { browserSupportsColors } from './log-colors'

/**
Expand All @@ -12,8 +11,11 @@ import { browserSupportsColors } from './log-colors'
* loggers will not work any more.
*/
export function LoggerBrowserSetupDebugFactory(opt: LogHandlerOptions = {}) {
const localStorage = getLocalStorage()
const filter = opt.filter ?? localStorage?.zeed ?? localStorage?.debug
const filter = opt.filter ?? (
typeof localStorage !== 'undefined'
? (localStorage.zeed ?? localStorage.debug)
: undefined)

const styleFont = 'font-family: "JetBrains Mono", Menlo; font-size: 11px;'
const styleDefault = `${styleFont}`
const styleBold = `font-weight: 600; ${styleFont}`
Expand Down
5 changes: 2 additions & 3 deletions src/browser/log/log-context-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import type { LogConfig } from '../../common/log/log-config'
import { isEmpty } from '../../common/data/is'
import { getGlobalLogger } from '../../common/log/log'
import { _LoggerFromConfig } from '../../common/log/log-config'
import { getLocalStorage, isBrowser } from '../../common/platform'
import { isBrowser } from '../../common/platform'
import { LoggerBrowserHandler } from './log-browser'
import { LoggerBrowserSetupDebugFactory } from './log-browser-factory'

export function Logger(name?: string, level?: LogLevelAliasType): LoggerInterface {
return getGlobalLogger((context) => {
const localStorage = getLocalStorage()
if (isBrowser() && !isEmpty(localStorage?.getItem('zeed'))) {
if (isBrowser() && (typeof localStorage !== 'undefined' ? !isEmpty(localStorage?.getItem('zeed')) : false)) {
context.setHandlers([LoggerBrowserHandler()]) // Fallback for previously registered Loggers
context.setFactory(LoggerBrowserSetupDebugFactory({}))
}
Expand Down

0 comments on commit be05149

Please sign in to comment.