Skip to content

Commit 5fda197

Browse files
committed
feat: createLogger, logger
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent 9fea64e commit 5fda197

File tree

81 files changed

+2699
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2699
-38
lines changed

.attw.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"color": true,
33
"emoji": true,
44
"format": "ascii",
5-
"ignoreRules": ["cjs-resolves-to-esm", "internal-resolution-error"],
5+
"ignoreRules": [
6+
"cjs-resolves-to-esm",
7+
"internal-resolution-error",
8+
"no-resolution"
9+
],
610
"summary": true
711
}

.codecov.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ ignore:
8484
- src/internal/*.browser.mts
8585

8686
profiling:
87-
critical_files_paths: []
87+
critical_files_paths:
88+
- src/lib/create-logger.mts

.commitlintrc.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import { scopes } from '@flex-development/commitlint-config'
1515
const config: UserConfig = {
1616
extends: ['@flex-development'],
1717
rules: {
18-
'scope-enum': [RuleConfigSeverity.Error, 'always', scopes(['chore'])]
18+
'scope-enum': [RuleConfigSeverity.Error, 'always', scopes([
19+
'chore',
20+
'reporters'
21+
])]
1922
}
2023
}
2124

.dictionary.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ gpgsign
1313
hmarr
1414
jchen
1515
kaisugi
16+
ksort
17+
mkbuild
1618
nvmrc
1719
pkgs
1820
remarkrc
1921
sarif
2022
shfmt
21-
smob
2223
unstub
2324
vates
2425
vitest

.github/infrastructure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ repository:
165165
automated_security_fixes: true
166166
default_branch: main
167167
delete_branch_on_merge: true
168-
description: logging utilities
168+
description: ':knot: a small logging library'
169169
has_issues: true
170170
has_projects: true
171171
has_wiki: false

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# log
1+
# \:knot: log
22

33
[![github release](https://img.shields.io/github/v/release/flex-development/log.svg?include_prereleases\&sort=semver)](https://github.com/flex-development/log/releases/latest)
44
[![npm](https://img.shields.io/npm/v/@flex-development/log.svg)](https://npmjs.com/package/@flex-development/log)
@@ -10,7 +10,7 @@
1010
[![vitest](https://img.shields.io/badge/-vitest-6e9f18?style=flat\&logo=vitest\&logoColor=ffffff)](https://vitest.dev)
1111
[![yarn](https://img.shields.io/badge/-yarn-2c8ebb?style=flat\&logo=yarn\&logoColor=ffffff)](https://yarnpkg.com)
1212

13-
Logging utilities
13+
Log messages in the terminal and browser
1414

1515
## Contents
1616

@@ -23,13 +23,15 @@ Logging utilities
2323

2424
## What is this?
2525

26-
**TODO**: what is this?
26+
This is a small, but useful, library for logging messages in the terminal and browser consoles.
27+
28+
Colorful messages can be logged in the terminal and browser consoles that support ANSI colors.
2729

2830
## Install
2931

3032
This package is [ESM only][esm].
3133

32-
In Node.js (version 18+) with [yarn][]:
34+
In Node.js with [yarn][]:
3335

3436
```sh
3537
yarn add @flex-development/log
@@ -52,7 +54,7 @@ In browsers with [`esm.sh`][esmsh]:
5254

5355
```html
5456
<script type="module">
55-
import { createLogger } from 'https://esm.sh/@flex-development/log'
57+
import { logger } from 'https://esm.sh/@flex-development/log'
5658
</script>
5759
```
5860

__tests__/reporters/verbose.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* @see https://vitest.dev/advanced/reporters#exported-reporters
55
*/
66

7+
import colors, { type Colors } from '@flex-development/colors'
78
import type { Task, TaskResultPack } from '@vitest/runner'
89
import { getNames, getTests } from '@vitest/runner/utils'
9-
import colors, { type Colors } from 'tinyrainbow'
1010
import type { RunnerTask, RunnerTestFile } from 'vitest'
1111
import type { ConfigEnv } from 'vitest/config'
1212
import { DefaultReporter, type Reporter } from 'vitest/reporters'

eslint.base.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ export default [
633633
'no-redeclare': 0,
634634
'no-restricted-imports': 0,
635635
'no-return-await': 0,
636+
'no-setter-return': 0,
636637
'no-shadow': 0,
637638
'no-sparse-arrays': 0,
638639
'no-throw-literal': 0,
@@ -1036,7 +1037,9 @@ export default [
10361037
},
10371038
{
10381039
files: [
1040+
'**/*.abstract.+(mts|ts)',
10391041
'**/*.interface.+(mts|ts)',
1042+
'**/abstract.*.+(mts|ts)',
10401043
'**/interfaces/*.+(mts|ts)',
10411044
'**/types/*.+(mts|ts)'
10421045
],

eslint.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,17 @@ export default [
2828
'**/dist/',
2929
'**/tsconfig*temp.json'
3030
]
31+
},
32+
{
33+
files: ['src/enums/log-levels.mts'],
34+
rules: {
35+
'sort-keys': 0
36+
}
37+
},
38+
{
39+
files: ['src/interfaces/log-function.mts'],
40+
rules: {
41+
'@typescript-eslint/unified-signatures': 0
42+
}
3143
}
3244
]

package.json

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flex-development/log",
3-
"description": "Logging utilities",
3+
"description": "Log messages in the terminal and browser",
44
"version": "4.0.1-dev.3",
55
"keywords": [
66
"log",
@@ -41,9 +41,21 @@
4141
"log": "./src/index.mts",
4242
"default": "./dist/index.mjs"
4343
},
44-
"./package.json": "./package.json"
44+
"./package.json": "./package.json",
45+
"./reporters": {
46+
"log": "./src/reporters/index.mts",
47+
"default": "./dist/reporters/index.mjs"
48+
},
49+
"./utils": {
50+
"log": "./src/utils/index.mts",
51+
"default": "./dist/utils/index.mjs"
52+
}
4553
},
4654
"imports": {
55+
"#enums/*": {
56+
"log": "./src/enums/*.mts",
57+
"default": "./dist/enums/*.mjs"
58+
},
4759
"#interfaces/*": {
4860
"log": "./src/interfaces/*.mts",
4961
"default": "./dist/interfaces/*.d.mts"
@@ -61,6 +73,18 @@
6173
"log": "./src/internal/*.mts",
6274
"default": "./dist/internal/*.mjs"
6375
},
76+
"#lib/*": {
77+
"log": "./src/lib/*.mts",
78+
"default": "./dist/lib/*.mjs"
79+
},
80+
"#logger": {
81+
"log": "./src/logger.mts",
82+
"default": "./dist/logger.mjs"
83+
},
84+
"#reporters/*": {
85+
"log": "./src/reporters/*.mts",
86+
"default": "./dist/reporters/*.mjs"
87+
},
6488
"#tests/*": "./__tests__/*.mts",
6589
"#types/*": {
6690
"log": "./src/types/*.mts",
@@ -70,7 +94,7 @@
7094
"module": "./dist/index.mjs",
7195
"types": "./dist/index.d.mts",
7296
"scripts": {
73-
"build": "yarn clean:build; tsc -p tsconfig.build.json --noEmit false; trash ./dist/internal/*.d.mts && trash ./dist/{interfaces,types}/*.mjs",
97+
"build": "yarn clean:build; tsc -p tsconfig.build.json --noEmit false; trash ./dist/{enums,internal}/*.d.*; trash ./dist/{interfaces,types}/*.mjs",
7498
"check:ci": "yarn dedupe --check && yarn check:format && yarn check:lint && yarn check:spelling && yarn typecheck && yarn test:cov && yarn pack && yarn check:types:build && attw package.tgz && yarn clean:pack",
7599
"check:format": "dprint check --incremental=false",
76100
"check:lint": "eslint --exit-on-fatal-error --max-warnings 0 .",
@@ -108,11 +132,10 @@
108132
"typecheck:ui": "yarn test:ui --typecheck --mode=typecheck"
109133
},
110134
"dependencies": {
111-
"@flex-development/pathe": "4.0.1",
135+
"@flex-development/colors": "1.0.0",
112136
"@flex-development/tutils": "6.0.0-alpha.25",
113-
"is-unicode-supported": "2.1.0",
114-
"smob": "1.5.0",
115-
"tinyrainbow": "2.0.0"
137+
"devlop": "1.1.0",
138+
"is-unicode-supported": "2.1.0"
116139
},
117140
"devDependencies": {
118141
"@arethetypeswrong/cli": "0.17.3",
@@ -121,6 +144,7 @@
121144
"@eslint/js": "9.19.0",
122145
"@flex-development/commitlint-config": "1.0.1",
123146
"@flex-development/grease": "3.0.0-alpha.9",
147+
"@flex-development/pathe": "4.0.1",
124148
"@stylistic/eslint-plugin": "2.13.0",
125149
"@tsconfig/strictest": "2.0.5",
126150
"@types/eslint": "9.6.1",
@@ -136,7 +160,6 @@
136160
"@vitest/ui": "3.0.4",
137161
"cross-env": "7.0.3",
138162
"cspell": "8.17.2",
139-
"devlop": "1.1.0",
140163
"dprint": "0.48.0",
141164
"editorconfig": "2.0.0",
142165
"eslint": "9.19.0",

0 commit comments

Comments
 (0)