Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ecopages/logger

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ecopages/logger - npm Package Compare versions

Comparing version
0.1.2
to
0.1.3
+7
-1
dist/logger.d.ts

@@ -0,1 +1,4 @@

interface LoggerOptions {
debug?: boolean;
}
/**

@@ -6,2 +9,3 @@ * Represents a logger that can be used to log messages with different log levels.

private readonly prefix;
private options;
/**

@@ -11,3 +15,3 @@ * Creates a new instance of the Logger class.

*/
constructor(prefix: string);
constructor(prefix: string, options?: LoggerOptions);
/**

@@ -30,2 +34,3 @@ * Logs an informational message.

* Logs a debug message.
* This method will only log messages if the debug option is set to true.
* @param args The arguments to be logged.

@@ -36,1 +41,2 @@ */

}
export {};
+1
-1

@@ -1,1 +0,1 @@

var k;(function(q){q["INFO"]="INFO";q["ERROR"]="ERROR";q["WARN"]="WARN";q["DEBUG"]="DEBUG"})(k||(k={}));var K={level:k.INFO},M={level:k.ERROR},P={level:k.WARN},Q={level:k.DEBUG};class V{prefix;constructor(j){this.prefix=j}info(...j){this.logInternal(K,...j)}warn(...j){this.logInternal(P,...j)}error(...j){this.logInternal(M,...j)}debug(...j){if(process.env.ECOPAGES_LOGGER_DEBUG==="true")this.logInternal(Q,...j)}logInternal(j,...H){const z=j?{[k.INFO]:"\x1B[32m",[k.ERROR]:"\x1B[31m",[k.WARN]:"\x1B[33m",[k.DEBUG]:"\x1B[36m"}[j.level]:"",J=`${z?z:""}${this.prefix}`;console.log(J,...H,"\x1B[0m")}}export{V as Logger};
var H={level:"INFO"},J={level:"ERROR"},K={level:"WARN"},M={level:"DEBUG"};class P{prefix;options={debug:!1};constructor(j,k){if(this.prefix=j,k)this.options=k}info(...j){this.logInternal(H,...j)}warn(...j){this.logInternal(K,...j)}error(...j){this.logInternal(J,...j)}debug(...j){if(this.options.debug)this.logInternal(M,...j)}logInternal(j,...k){const q=j?{["INFO"]:"\x1B[32m",["ERROR"]:"\x1B[31m",["WARN"]:"\x1B[33m",["DEBUG"]:"\x1B[36m"}[j.level]:"",z=`${q?q:""}${this.prefix}`;console.log(z,...k,"\x1B[0m")}}export{P as Logger};
{
"name": "@ecopages/logger",
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "./dist/logger.js",

@@ -66,7 +66,12 @@ # @ecopages/logger

Debugging Instructions
By default, the debugging feature is turned off. To enable it, please add the following line to your `.env` file:
### Debugging Instructions
```sh
ECOPAGES_LOGGER_DEBUG=true
By default, the debugging feature is turned off. To enable it you can provide an options object to the logger constructor.
```ts
const logger = new Logger("[my-app]", { debug: true });
```
```bash
[my-app] This is a debug message
```