Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kosko/log

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kosko/log - npm Package Compare versions

Comparing version 0.0.0-20240324064444 to 0.0.0-20240324074257

dist/index.d.ts.map

130

dist/index.d.ts
/**
* Logging library.
* @public
*/
declare enum LogLevel {
Trace = 1,
Debug = 2,
Info = 3,
Warn = 4,
Error = 5,
Fatal = 6
}
/**
* @public
*/
declare function logLevelFromString(level: string): LogLevel | undefined;
/**
* @public
*/
interface Log {
loggerLevel: LogLevel;
level: LogLevel;
time: Date;
message?: string;
error?: unknown;
data?: unknown;
}
/**
* @public
*/
interface LogWriter {
write(log: Log): void;
}
/**
* @public
*/
interface LoggerOptions {
level?: LogLevel;
writer?: LogWriter;
}
/**
* @public
*/
declare class Logger {
private level;
private writer;
constructor(options: Required<LoggerOptions>);
/**
* @example
* Basic message
* ```ts
* logger.log(LogLevel.Info, "basic message");
* ```
*
* @example
* Error
* ```ts
* logger.log(LogLevel.Error, "error log", {
* error: new Error("error cause")
* });
* ```
*
* @example
* Data
* ```ts
* logger.log(LogLevel.Info, "log with data", {
* data: {
* foo: "bar"
* }
* });
* ```
*/
log(level: LogLevel, message: string, options?: Partial<Omit<Log, "level" | "message" | "loggerLevel">>): void;
/**
* Returns logger level.
*/
getLevel(): LogLevel;
/**
* Sets logger level.
*/
setLevel(level: LogLevel): void;
/**
* Returns true if the given `level` is enabled in logger.
*/
enabled(level: LogLevel): boolean;
/**
* Returns writer of logger.
*/
getWriter(): LogWriter;
/**
* Sets writer of logger.
*/
setWriter(writer: LogWriter): void;
}
/**
* Prints logs to console.
*
* @packageDocumentation
* @public
*/
export * from "./types";
export { default as ConsoleLogWriter } from "./ConsoleLogWriter";
export { default as SilentLogWriter } from "./SilentLogWriter";
export { LogLevel, logLevelFromString } from "./LogLevel";
export { default as Logger, type LoggerOptions } from "./Logger";
export { createLogger } from "./createLogger";
declare const _default: import("./Logger").default;
export default _default;
declare class ConsoleLogWriter implements LogWriter {
write(log: Log): void;
}
/**
* Omits logs.
*
* @public
*/
declare class SilentLogWriter implements LogWriter {
write(): void;
}
/**
* @public
*/
declare const createLogger: (options?: Partial<LoggerOptions>) => Logger;
declare const _default: Logger;
export { ConsoleLogWriter, type Log, LogLevel, type LogWriter, Logger, type LoggerOptions, SilentLogWriter, createLogger, _default as default, logLevelFromString };
//# sourceMappingURL=index.d.ts.map

4

package.json
{
"name": "@kosko/log",
"version": "0.0.0-20240324064444",
"version": "0.0.0-20240324074257",
"description": "Logging library for Kosko.",

@@ -50,3 +50,3 @@ "homepage": "https://kosko.dev",

"picocolors": "^1.0.0",
"@kosko/common-utils": "^0.0.0-20240324064444"
"@kosko/common-utils": "^0.0.0-20240324074257"
},

@@ -53,0 +53,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc