New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

swork-logger

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swork-logger - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

16

dist/fetch-data.d.ts

@@ -9,3 +9,3 @@ /**

constructor(request: Request);
readonly hasResponse: boolean;
get hasResponse(): boolean;
/**

@@ -17,3 +17,3 @@ * The resulting response. Returned value is a clone.

*/
readonly response: Response;
get response(): Response;
/**

@@ -33,3 +33,3 @@ * Sets the response and time to execute

*/
readonly url: string;
get url(): string;
/**

@@ -41,11 +41,11 @@ * The HTTP method

*/
readonly method: string;
get method(): string;
/**
* The initiating request
*/
readonly request: Request;
get request(): Request;
/**
* How long the request took in milliseconds
*/
readonly executionTime: number;
get executionTime(): number;
/**

@@ -57,7 +57,7 @@ * Indicates if the response is ok

*/
readonly ok: boolean;
get ok(): boolean;
/**
* status of the response
*/
readonly status: number;
get status(): number;
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -16,3 +17,3 @@ });

instance = instance || new fetch_logger_1.FetchLogger();
return (context, next) => __awaiter(this, void 0, void 0, function* () {
return (context, next) => __awaiter(void 0, void 0, void 0, function* () {
const fetchData = new fetch_data_1.FetchData(context.request);

@@ -19,0 +20,0 @@ const start = performance.now();

{
"name": "swork-logger",
"version": "1.0.0",
"version": "1.0.1",
"description": "Logger for the swork framework.",

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

# swork-logger
swork-logger is a swork middleware designed to log info for every fetch made through the service worker. It is built with TypeScript and async methods.
swork-logger is a [swork](https://www.npmjs.com/package/swork) middleware designed to log info for every fetch request made through the service worker. It is built with TypeScript and async methods.
**INSTALLATION**
**License**
MIT
**Installation**
`npm install swork-logger`

@@ -11,3 +15,3 @@

**EXAMPLE**
**Example**

@@ -25,3 +29,3 @@ ```ts

**NOTES**
## Notes

@@ -33,9 +37,12 @@ It is suggested to include `logger` early in the request pipeline to be able to log all fetch requests. The default message will provide contextual information regarding each request including the http method, url, status and execution time. In addition, each log entry is color coded based upon the status.

```ts
interface IFetchLogger {
log: (data: FetchData) => void;
class CustomLogger implements IFetchLogger {
public log(data: FetchData) { ... }
}
class CustomLogger implements IFetchLogger { ... }
app.use(logger(new CustomLogger()));
```
## Contact
If you are using [swork](https://www.npmjs.com/package/swork) or any of its related middlewares, please let me know on [gitter](https://gitter.im/swork-chat/community). I am always looking for feedback or additional middleware ideas.
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