@holz/core 0.1.0 → 0.2.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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var s=(e=>(e.Error="error",e.Warn="warn",e.Info="info",e.Debug="debug",e))(s||{});class t{constructor(r,o){this.processor=r,this.origin=o,Object.defineProperty(this,"processor",{configurable:!1,enumerable:!1})}static create(r){return new t(r,[])}namespace(r){return new t(this.processor,this.origin.concat(r))}debug(r,o){this.forwardLog(s.Debug,r,o)}info(r,o){this.forwardLog(s.Info,r,o)}warn(r,o){this.forwardLog(s.Warn,r,o)}error(r,o){this.forwardLog(s.Error,r,o)}forwardLog(r,o,i={}){this.processor.processLog({message:o,level:r,origin:this.origin,context:i})}}const c=t.create;class n{constructor(r){this.processors=r}processLog(r){this.processors.forEach(o=>{o.processLog(r)})}}function a(e){return new n(e)}class g{constructor(r,o){this.predicate=r,this.processor=o}processLog(r){this.predicate(r)&&this.processor.processLog(r)}}function f(e,r){return new g(e,r)}exports.LogLevel=s;exports.combine=a;exports.createLogger=c;exports.filter=f;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@holz/core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A structured and composable logger",
5
5
  "type": "module",
6
- "main": "./dist/holz-core.umd.cjs",
6
+ "main": "./dist/holz-core.cjs",
7
7
  "module": "./dist/holz-core.js",
8
8
  "types": "./src/index.ts",
9
9
  "repository": {
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "exports": {
15
15
  ".": {
16
- "require": "./dist/holz-core.umd.cjs",
16
+ "require": "./dist/holz-core.cjs",
17
17
  "import": "./dist/holz-core.js"
18
18
  }
19
19
  },
@@ -33,7 +33,7 @@
33
33
  "logger"
34
34
  ],
35
35
  "scripts": {
36
- "prepare": "vite build",
36
+ "prepack": "vite build",
37
37
  "test:unit": "vitest --color --passWithNoTests",
38
38
  "test:types": "tsc"
39
39
  },
@@ -1 +0,0 @@
1
- (function(t,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(t=typeof globalThis<"u"?globalThis:t||self,s(t["holz-core"]={}))})(this,function(t){"use strict";var s=(o=>(o.Error="error",o.Warn="warn",o.Info="info",o.Debug="debug",o))(s||{});class i{constructor(r,e){this.processor=r,this.origin=e,Object.defineProperty(this,"processor",{configurable:!1,enumerable:!1})}static create(r){return new i(r,[])}namespace(r){return new i(this.processor,this.origin.concat(r))}debug(r,e){this.forwardLog(s.Debug,r,e)}info(r,e){this.forwardLog(s.Info,r,e)}warn(r,e){this.forwardLog(s.Warn,r,e)}error(r,e){this.forwardLog(s.Error,r,e)}forwardLog(r,e,d={}){this.processor.processLog({message:e,level:r,origin:this.origin,context:d})}}const n=i.create;class c{constructor(r){this.processors=r}processLog(r){this.processors.forEach(e=>{e.processLog(r)})}}function f(o){return new c(o)}class a{constructor(r,e){this.predicate=r,this.processor=e}processLog(r){this.predicate(r)&&this.processor.processLog(r)}}function u(o,r){return new a(o,r)}t.LogLevel=s,t.combine=f,t.createLogger=n,t.filter=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});