@ttoss/logger 0.1.1 → 0.1.2

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,30 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/index.ts
4
+ var {
5
+ log,
6
+ warn,
7
+ error
8
+ } = console;
9
+ var isDev = import.meta?.env?.DEV || process.env?.DEV === "true";
10
+ var Logger = prefix => {
11
+ return {
12
+ warn: value => {
13
+ if (isDev) {
14
+ const now = /* @__PURE__ */new Date();
15
+ warn(`[${now}] - ${prefix} - ${value}`);
16
+ }
17
+ },
18
+ info: value => {
19
+ if (isDev) {
20
+ const now = /* @__PURE__ */new Date();
21
+ log(`[${now}] - ${prefix} - ${value}`);
22
+ }
23
+ },
24
+ error: value => {
25
+ const now = /* @__PURE__ */new Date();
26
+ error(`[${now}] - ${prefix} - ${value}`);
27
+ }
28
+ };
29
+ };
30
+ export { Logger };
@@ -0,0 +1,7 @@
1
+ declare const Logger: (prefix: string) => {
2
+ warn: (value: string) => void;
3
+ info: (value: string) => void;
4
+ error: (value: string) => void;
5
+ };
6
+
7
+ export { Logger };
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ "use strict";
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
24
+ value: true
25
+ }), mod);
26
+
27
+ // src/index.ts
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ Logger: () => Logger
31
+ });
32
+ module.exports = __toCommonJS(src_exports);
33
+ var import_meta = {};
34
+ var {
35
+ log,
36
+ warn,
37
+ error
38
+ } = console;
39
+ var isDev = import_meta?.env?.DEV || process.env?.DEV === "true";
40
+ var Logger = prefix => {
41
+ return {
42
+ warn: value => {
43
+ if (isDev) {
44
+ const now = /* @__PURE__ */new Date();
45
+ warn(`[${now}] - ${prefix} - ${value}`);
46
+ }
47
+ },
48
+ info: value => {
49
+ if (isDev) {
50
+ const now = /* @__PURE__ */new Date();
51
+ log(`[${now}] - ${prefix} - ${value}`);
52
+ }
53
+ },
54
+ error: value => {
55
+ const now = /* @__PURE__ */new Date();
56
+ error(`[${now}] - ${prefix} - ${value}`);
57
+ }
58
+ };
59
+ };
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ Logger
63
+ });
package/package.json CHANGED
@@ -1,18 +1,29 @@
1
1
  {
2
2
  "name": "@ttoss/logger",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Simple environment agnostic logger",
5
5
  "license": "MIT",
6
6
  "contributors": [
7
7
  "Eron Alves <eron.alves@rocketmail.com>"
8
8
  ],
9
- "main": "index.js",
9
+ "main": "dist/index.js",
10
+ "module": "dist/esm/index.js",
11
+ "files": [
12
+ "dist",
13
+ "src"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsup"
17
+ },
18
+ "sideEffects": false,
19
+ "typings": "dist/index.d.ts",
10
20
  "devDependencies": {
11
- "@ttoss/config": "^1.29.5"
21
+ "@ttoss/config": "^1.29.5",
22
+ "tsup": "^6.7.0"
12
23
  },
13
24
  "keywords": [],
14
25
  "publishConfig": {
15
26
  "access": "public"
16
27
  },
17
- "gitHead": "13f3d2b990be54d050adfe8d05d10cf16d127177"
28
+ "gitHead": "a88441c42699c2ed915fb24c136baef76e6287ff"
18
29
  }
package/CHANGELOG.md DELETED
@@ -1,10 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## 0.1.1 (2023-04-25)
7
-
8
- ### Bug Fixes
9
-
10
- - public access logger package ([#298](https://github.com/ttoss/ttoss/issues/298)) ([79ce406](https://github.com/ttoss/ttoss/commit/79ce406631943687a9814f2b8f23adbe79aab206))
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "@ttoss/config/tsconfig.json",
3
- // supports `import.meta`
4
- "compilerOptions": {
5
- "module": "es2020"
6
- }
7
- }