sassy-logger 1.0.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.
package/.idx/dev.nix ADDED
@@ -0,0 +1,53 @@
1
+ # To learn more about how to use Nix to configure your environment
2
+ # see: https://developers.google.com/idx/guides/customize-idx-env
3
+ { pkgs, ... }: {
4
+ # Which nixpkgs channel to use.
5
+ channel = "stable-24.05"; # or "unstable"
6
+ # Use https://search.nixos.org/packages to find packages
7
+ packages = [
8
+ # pkgs.go
9
+ # pkgs.python311
10
+ # pkgs.python311Packages.pip
11
+ # pkgs.nodejs_20
12
+ # pkgs.nodePackages.nodemon
13
+ ];
14
+ # Sets environment variables in the workspace
15
+ env = {};
16
+ idx = {
17
+ # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
18
+ extensions = [
19
+ # "vscodevim.vim"
20
+ ];
21
+ # Enable previews
22
+ previews = {
23
+ enable = true;
24
+ previews = {
25
+ # web = {
26
+ # # Example: run "npm run dev" with PORT set to IDX's defined port for previews,
27
+ # # and show it in IDX's web preview panel
28
+ # command = ["npm" "run" "dev"];
29
+ # manager = "web";
30
+ # env = {
31
+ # # Environment variables to set for your server
32
+ # PORT = "$PORT";
33
+ # };
34
+ # };
35
+ };
36
+ };
37
+ # Workspace lifecycle hooks
38
+ workspace = {
39
+ # Runs when a workspace is first created
40
+ onCreate = {
41
+ # Example: install JS dependencies from NPM
42
+ # npm-install = "npm install";
43
+ # Open editors for the following files by default, if they exist:
44
+ default.openFiles = [ ".idx/dev.nix" "README.md" ];
45
+ };
46
+ # Runs when the workspace is (re)started
47
+ onStart = {
48
+ # Example: start a background task to watch and re-build backend code
49
+ # watch-backend = "npm run watch-backend";
50
+ };
51
+ };
52
+ };
53
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nghi Hua
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+
2
+ <!-- PROJECT LOGO -->
3
+ <br />
4
+ <div align="center">
5
+ <a href="https://github.com/nghihua/sassy-logger">
6
+ <h1>πŸ’…</h1>
7
+ </a>
8
+
9
+ <h3 align="center">Sassy Logger</h3>
10
+
11
+ <p align="center">
12
+ A logger utility, but sassy.
13
+ <br />
14
+ <a href="https://github.com/nghihua/sassy-logger"><strong>Explore the docs Β»</strong></a>
15
+ <br />
16
+ <br />
17
+ <a href="https://github.com/nghihua/sassy-logger/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
18
+ &middot;
19
+ <a href="https://github.com/nghihua/sassy-logger/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
20
+ </p>
21
+ </div>
22
+
23
+
24
+
25
+ <!-- TABLE OF CONTENTS -->
26
+ <details>
27
+ <summary>Table of Contents</summary>
28
+ <ol>
29
+ <li>
30
+ <a href="#about-the-project">About The Project</a>
31
+ </li>
32
+ <li>
33
+ <a href="#getting-started">Getting Started</a>
34
+ <ul>
35
+ <li><a href="#installation">Installation</a></li>
36
+ <li><a href="#usage">Usage</a></li>
37
+ </ul>
38
+ </li>
39
+ <li><a href="#contributing">Contributing</a></li>
40
+ <li><a href="#license">License</a></li>
41
+ <li><a href="#contact">Contact</a></li>
42
+ </ol>
43
+ </details>
44
+
45
+
46
+
47
+ <!-- ABOUT THE PROJECT -->
48
+ ## About The Project
49
+
50
+ As an attempt to publish my first NPM package, I create this logger utility to basically prefix your logs with a sassy remark. Happy coding!
51
+
52
+ <p align="right">(<a href="#readme-top">back to top</a>)</p>
53
+
54
+ <!-- USAGE EXAMPLES -->
55
+ ## Getting Started
56
+
57
+ ### Installation
58
+
59
+ This package is hosted on NPM and therefore can be installed with:
60
+ * npm
61
+ ```sh
62
+ npm install sassy-logger
63
+ ```
64
+
65
+ ### Usage
66
+
67
+ Log with specific methods:
68
+ ```javascript
69
+ import SassyLogger from 'sassy-logger';
70
+
71
+ SassyLogger.debug("Initializing API client with parameters...");
72
+ // Output: [πŸ” Just a little check-in] Initializing API client with parameters...
73
+
74
+ SassyLogger.info("Server is running on port %d.", port);
75
+ // Output: [πŸ’€ It’s cute that you think this matters.] Server is running on port 3000
76
+
77
+ SassyLogger.warn("API rate limit almost exceeded.");
78
+ // Output: [🀑 Plot twist...] API rate limit almost exceeded.
79
+
80
+ SassyLogger.error("Unexpected shutdown.");
81
+ // Output: [πŸ”₯ Absolute disaster incoming] Unexpected shutdown.
82
+
83
+ SassyLogger.fatal("System crash! Shutting down.");
84
+ // Output: [πŸ’€ Hope you updated your will] System crash! Shutting down.
85
+
86
+ SassyLogger.oops("Missed a semicolon, causing the syntax error.");
87
+ // Output: [😬 That’s on you...] Missed a semicolon, causing the syntax error.
88
+
89
+ SassyLogger.blessed("Successfully deployed the latest version!");
90
+ // Output: [✨ The universe has smiled upon us] Successfully deployed the latest version!
91
+ ```
92
+ Generic log method:
93
+ ```javascript
94
+ import SassyLogger from 'sassy-logger';
95
+
96
+ // default
97
+ SassyLogger.log("Returned value is 36.");
98
+ // Output: [🀷 Whatever] Initializing API client with parameters...
99
+
100
+ // with level
101
+ SassyLogger.log("Returned value is 36.", "debug");
102
+ // Output: [πŸ” Just a little check-in] Initializing API client with parameters...
103
+ ```
104
+
105
+ <p align="right">(<a href="#readme-top">back to top</a>)</p>
106
+
107
+ <!-- CONTRIBUTING -->
108
+ ## Contributing
109
+
110
+ Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
111
+
112
+ If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
113
+ Don't forget to give the project a star! Thanks again!
114
+
115
+ 1. Fork the Project
116
+ 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
117
+ 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
118
+ 4. Push to the Branch (`git push origin feature/AmazingFeature`)
119
+ 5. Open a Pull Request
120
+
121
+ <!-- LICENSE -->
122
+ ## License
123
+
124
+ Distributed under the MIT License. See `LICENSE.txt` for more information.
125
+
126
+ <p align="right">(<a href="#readme-top">back to top</a>)</p>
127
+
128
+ <!-- CONTACT -->
129
+ ## Contact
130
+
131
+ Nghi Hua - https://nghihua.io.vn/
132
+
133
+ <p align="right">(<a href="#readme-top">back to top</a>)</p>
package/index.js ADDED
@@ -0,0 +1,26 @@
1
+ class SassyLogger {
2
+ static log(message, level) {
3
+ const prefixes = {
4
+ debug: "πŸ” Just a little check-in",
5
+ info: "πŸ’€ It’s cute that you think this matters.",
6
+ warn: "🀑 Plot twist...",
7
+ error: "πŸ”₯ Absolute disaster incoming",
8
+ fatal: "πŸ’€ Hope you updated your will",
9
+ oops: '😬 That’s on you...',
10
+ blessed: '✨ The universe has smiled upon us',
11
+ };
12
+
13
+ const prefix = prefixes[level] || "🀷 Whatever";
14
+ console.log(`[${prefix}] ${message}`);
15
+ }
16
+
17
+ static debug(msg) { this.log("debug", msg); }
18
+ static info(msg) { this.log("info", msg); }
19
+ static warn(msg) { this.log("warn", msg); }
20
+ static error(msg) { this.log("error", msg); }
21
+ static fatal(msg) { this.log("fatal", msg); }
22
+ static oops(msg) { this.log("oops", msg); }
23
+ static fatal(msg) { this.log("fatal", msg); }
24
+ }
25
+
26
+ module.exports = SassyLogger;
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "sassy-logger",
3
+ "version": "1.0.2",
4
+ "description": "Logger utility, but sassy",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "Nghi Hua",
10
+ "license": "MIT"
11
+ }