Skip to content

Commit

Permalink
release v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
stegano committed Apr 18, 2024
1 parent d317b43 commit b6be2fd
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 3 deletions.
25 changes: 25 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Transport from "winston-transport";
import { S3Client } from "@aws-sdk/client-s3";
import { LogGroup, Options, S3TransportConfig } from "./index.interface";
declare class S3Transport extends Transport {
logGroups: Record<string, LogGroup>;
s3Client: S3Client;
s3TransportConfig: Required<S3TransportConfig>;
constructor(options: Options);
updateLogGroupList(logGroupIdList?: string[]): Promise<boolean>;
/**
* Create bucket path
*/
static createBucketPath(groupId: string, s3TransportConfig: S3TransportConfig): string;
/**
* Create log group
*/
static createLogGroup(groupId: string, s3TransportConfig: S3TransportConfig): LogGroup;
log(logInfo: any, callback: any): Promise<void>;
static calcDataSize(data: any): number;
/**
* Upload data to s3 bucket
*/
static uploadToS3Bucket(s3Client: S3Client, bucket: string, bucketPath: string, data: any[], compress?: boolean): Promise<boolean>;
}
export default S3Transport;
30 changes: 30 additions & 0 deletions dist/index.interface.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Transport from "winston-transport";
import { S3ClientConfig } from "@aws-sdk/client-s3";
export interface LogGroup {
data: any[];
bucket: string;
bucketPath: string;
createdTime: Date;
isUpdated: boolean;
uploadTime?: Date;
}
export interface S3TransportConfig {
bucket: string;
bucketPath: ((groupId: string) => string) | string;
group?: (<T = any>(logInfo: T) => string) | string;
/**
* @deprecated Use group instead of groupId.
*/
groupId?: (<T = any>(logInfo: T) => string) | string;
dataUploadInterval?: number;
maxDataSize?: number;
fileRotationInterval?: number;
gzip?: boolean;
}
export interface Options extends Transport.TransportStreamOptions {
/**
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html
*/
s3ClientConfig: S3ClientConfig;
s3TransportConfig: S3TransportConfig;
}
2 changes: 2 additions & 0 deletions dist/index.interface.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Loading

0 comments on commit b6be2fd

Please sign in to comment.