Socket
Socket
Sign inDemoInstall

explogger

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.1.0

.github/workflows/tests.yml

10

CHANGELOG.md
# CHANGELOG
## 2.1.0
### Features:
- Add configuration option to select output file extension type
### Bugfixes:
- Add file extension type when default filename is selected
## 2.0.1

@@ -4,0 +14,0 @@

3

dist/util.d.ts

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

export declare function middlewareLogger({ filename, filepath, dateFormat, includeReq, includeRes, }: IConfig): (req: any, res: any, next: any) => void;
export declare function middlewareLogger({ filename, filepath, dateFormat, includeReq, includeRes, outputFormat }?: IConfig): (req: any, res: any, next: any) => void;
export declare function prepareReqLogLine(req: any, dateFormat?: string, includeReq?: boolean): string;

@@ -9,3 +9,4 @@ interface IConfig {

includeRes?: boolean;
outputFormat?: string;
}
export {};

@@ -32,7 +32,7 @@ "use strict";

const dayjs_1 = __importDefault(require("dayjs"));
function middlewareLogger({ filename, filepath, dateFormat, includeReq = true, includeRes = true, }) {
function middlewareLogger({ filename, filepath, dateFormat, includeReq = true, includeRes = true, outputFormat } = {}) {
return (req, res, next) => {
const formattedFilename = filename
? `${(0, dayjs_1.default)().format('MM-DD-YYYY')}-${filename}`
: `${(0, dayjs_1.default)().format('MM-DD-YYYY')}-logfile.txt`;
let formattedFilename = filename
? `${(0, dayjs_1.default)().format('MM-DD-YYYY')}-${filename}${outputFormat ? outputFormat : '.log'}`
: `${(0, dayjs_1.default)().format('MM-DD-YYYY')}-logfile${outputFormat ? outputFormat : '.log'}`;
let formattedFilepath = '';

@@ -39,0 +39,0 @@ if (filepath) {

{
"name": "explogger",
"version": "2.0.1",
"version": "2.1.0",
"description": "Logging middleware for express",

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

@@ -16,2 +16,3 @@ # explogger

dateFormat: 'MM-YYYY',
outputFormat: '.log',
}),

@@ -35,2 +36,4 @@ );

`outputFormat`: String name of desired file extension type of logfile. (e.g., .log, .txt). Extension will default to `.log` if no value is provided.
**Example output**

@@ -37,0 +40,0 @@

@@ -10,7 +10,8 @@ import * as fs from 'fs';

includeRes = true,
}: IConfig) {
outputFormat
}: IConfig = {}) {
return (req: any, res: any, next: any) => {
const formattedFilename = filename
? `${dayjs().format('MM-DD-YYYY')}-${filename}`
: `${dayjs().format('MM-DD-YYYY')}-logfile.txt`;
let formattedFilename = filename
? `${dayjs().format('MM-DD-YYYY')}-${filename}${outputFormat ? outputFormat : '.log'}`
: `${dayjs().format('MM-DD-YYYY')}-logfile${outputFormat ? outputFormat : '.log'}`;
let formattedFilepath = '';

@@ -94,2 +95,3 @@ if (filepath) {

includeRes?: boolean;
outputFormat?: string;
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc