sdk-logs 0.6.13 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domain.objects/LogOutlet.d.ts +33 -0
- package/dist/domain.objects/LogOutlet.js +3 -0
- package/dist/domain.objects/LogOutlet.js.map +1 -0
- package/dist/domain.objects/LogTrail.d.ts +20 -4
- package/dist/domain.operations/asCurrentIsoTimestamp.d.ts +5 -0
- package/dist/domain.operations/asCurrentIsoTimestamp.js +12 -0
- package/dist/domain.operations/asCurrentIsoTimestamp.js.map +1 -0
- package/dist/domain.operations/formatLogContentsForEnvironment.d.ts +20 -1
- package/dist/domain.operations/formatLogContentsForEnvironment.js +22 -6
- package/dist/domain.operations/formatLogContentsForEnvironment.js.map +1 -1
- package/dist/domain.operations/genContextLogTrail.d.ts +28 -0
- package/dist/domain.operations/genContextLogTrail.js +58 -0
- package/dist/domain.operations/genContextLogTrail.js.map +1 -0
- package/dist/domain.operations/{generateLogMethods.d.ts → genLogMethods.d.ts} +13 -2
- package/dist/domain.operations/genLogMethods.js +42 -0
- package/dist/domain.operations/genLogMethods.js.map +1 -0
- package/dist/domain.operations/generateLogMethod.d.ts +8 -1
- package/dist/domain.operations/generateLogMethod.js +32 -14
- package/dist/domain.operations/generateLogMethod.js.map +1 -1
- package/dist/domain.operations/outlets/cloudwatch/asCloudWatchBatches.d.ts +8 -0
- package/dist/domain.operations/outlets/cloudwatch/asCloudWatchBatches.js +47 -0
- package/dist/domain.operations/outlets/cloudwatch/asCloudWatchBatches.js.map +1 -0
- package/dist/domain.operations/outlets/cloudwatch/asCloudWatchLogEvents.d.ts +9 -0
- package/dist/domain.operations/outlets/cloudwatch/asCloudWatchLogEvents.js +15 -0
- package/dist/domain.operations/outlets/cloudwatch/asCloudWatchLogEvents.js.map +1 -0
- package/dist/domain.operations/outlets/cloudwatch/asDefaultLogStreamName.d.ts +6 -0
- package/dist/domain.operations/outlets/cloudwatch/asDefaultLogStreamName.js +24 -0
- package/dist/domain.operations/outlets/cloudwatch/asDefaultLogStreamName.js.map +1 -0
- package/dist/domain.operations/outlets/cloudwatch/asLambdaStyleLogGroupName.d.ts +18 -0
- package/dist/domain.operations/outlets/cloudwatch/asLambdaStyleLogGroupName.js +57 -0
- package/dist/domain.operations/outlets/cloudwatch/asLambdaStyleLogGroupName.js.map +1 -0
- package/dist/domain.operations/outlets/cloudwatch/assertAwsCredentialsPresent.d.ts +8 -0
- package/dist/domain.operations/outlets/cloudwatch/assertAwsCredentialsPresent.js +46 -0
- package/dist/domain.operations/outlets/cloudwatch/assertAwsCredentialsPresent.js.map +1 -0
- package/dist/domain.operations/outlets/cloudwatch/computeLogEventSize.d.ts +8 -0
- package/dist/domain.operations/outlets/cloudwatch/computeLogEventSize.js +15 -0
- package/dist/domain.operations/outlets/cloudwatch/computeLogEventSize.js.map +1 -0
- package/dist/domain.operations/outlets/cloudwatch/drainBuffer.d.ts +6 -0
- package/dist/domain.operations/outlets/cloudwatch/drainBuffer.js +12 -0
- package/dist/domain.operations/outlets/cloudwatch/drainBuffer.js.map +1 -0
- package/dist/domain.operations/outlets/cloudwatch/genCloudwatchOutlet.d.ts +24 -0
- package/dist/domain.operations/outlets/cloudwatch/genCloudwatchOutlet.js +205 -0
- package/dist/domain.operations/outlets/cloudwatch/genCloudwatchOutlet.js.map +1 -0
- package/dist/domain.operations/withLogTrail.d.ts +1 -1
- package/dist/domain.operations/withLogTrail.js +58 -26
- package/dist/domain.operations/withLogTrail.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/dist/domain.operations/generateLogMethods.js +0 -22
- package/dist/domain.operations/generateLogMethods.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asLambdaStyleLogGroupName = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* .what = generates a lambda-style log group name
|
|
8
|
+
* .why = CloudWatch log groups follow `/aws/lambda/{service}-{env}` pattern
|
|
9
|
+
*
|
|
10
|
+
* .note = performs I/O when service is not provided:
|
|
11
|
+
* - reads package.json from cwd for service name
|
|
12
|
+
* - reads env vars (ENVIRONMENT_ACCESS, ENV_ACCESS, STAGE, NODE_ENV) for env.access
|
|
13
|
+
* for pure usage, pass both service and env.access explicitly.
|
|
14
|
+
*
|
|
15
|
+
* @param service - service name (default: reads from package.json)
|
|
16
|
+
* @param env.access - environment access level (default: from env vars, fallback 'local')
|
|
17
|
+
*/
|
|
18
|
+
const asLambdaStyleLogGroupName = ({ service, env, } = {}) => {
|
|
19
|
+
const serviceName = service ?? getPackageJsonName();
|
|
20
|
+
const envAccess = env?.access ?? getEnvironmentAccessFromEnvVar();
|
|
21
|
+
return `/aws/lambda/${serviceName}-${envAccess}`;
|
|
22
|
+
};
|
|
23
|
+
exports.asLambdaStyleLogGroupName = asLambdaStyleLogGroupName;
|
|
24
|
+
/**
|
|
25
|
+
* .what = reads package name from package.json in cwd
|
|
26
|
+
* .why = service name defaults to package name for consistency
|
|
27
|
+
*/
|
|
28
|
+
const getPackageJsonName = () => {
|
|
29
|
+
try {
|
|
30
|
+
const pkgPath = (0, path_1.join)(process.cwd(), 'package.json');
|
|
31
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf-8'));
|
|
32
|
+
return pkg.name ?? 'unknown-service';
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// allowlist: file not found or parse errors are expected in some environments
|
|
36
|
+
if (error instanceof Error &&
|
|
37
|
+
(error.message.includes('ENOENT') ||
|
|
38
|
+
error.message.includes('Unexpected token') ||
|
|
39
|
+
error.message.includes('JSON'))) {
|
|
40
|
+
return 'unknown-service';
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* .what = reads environment access from env var
|
|
47
|
+
* .why = enables environment-specific log groups (test, prep, prod)
|
|
48
|
+
*/
|
|
49
|
+
const getEnvironmentAccessFromEnvVar = () => {
|
|
50
|
+
// check common env var patterns
|
|
51
|
+
return (process.env.ENVIRONMENT_ACCESS ??
|
|
52
|
+
process.env.ENV_ACCESS ??
|
|
53
|
+
process.env.STAGE ??
|
|
54
|
+
process.env.NODE_ENV ??
|
|
55
|
+
'local');
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=asLambdaStyleLogGroupName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asLambdaStyleLogGroupName.js","sourceRoot":"","sources":["../../../../src/domain.operations/outlets/cloudwatch/asLambdaStyleLogGroupName.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAClC,+BAA4B;AAE5B;;;;;;;;;;;GAWG;AACI,MAAM,yBAAyB,GAAG,CAAC,EACxC,OAAO,EACP,GAAG,MAID,EAAE,EAAU,EAAE;IAChB,MAAM,WAAW,GAAG,OAAO,IAAI,kBAAkB,EAAE,CAAC;IACpD,MAAM,SAAS,GAAG,GAAG,EAAE,MAAM,IAAI,8BAA8B,EAAE,CAAC;IAClE,OAAO,eAAe,WAAW,IAAI,SAAS,EAAE,CAAC;AACnD,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC;AAEF;;;GAGG;AACH,MAAM,kBAAkB,GAAG,GAAW,EAAE;IACtC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACvD,OAAO,GAAG,CAAC,IAAI,IAAI,iBAAiB,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,8EAA8E;QAC9E,IACE,KAAK,YAAY,KAAK;YACtB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAC/B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;gBAC1C,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EACjC,CAAC;YACD,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,8BAA8B,GAAG,GAAW,EAAE;IAClD,gCAAgC;IAChC,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAC9B,OAAO,CAAC,GAAG,CAAC,UAAU;QACtB,OAAO,CAAC,GAAG,CAAC,KAAK;QACjB,OAAO,CAAC,GAAG,CAAC,QAAQ;QACpB,OAAO,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = validates AWS credentials are available via common sources
|
|
3
|
+
* .why = fail-fast at outlet creation rather than on first flush
|
|
4
|
+
*
|
|
5
|
+
* .note = checks env vars and shared credentials file.
|
|
6
|
+
* async credential providers (SSO, IAM roles) are validated on first flush.
|
|
7
|
+
*/
|
|
8
|
+
export declare const assertAwsCredentialsPresent: () => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertAwsCredentialsPresent = void 0;
|
|
4
|
+
const error_fns_1 = require("@ehmpathy/error-fns");
|
|
5
|
+
/**
|
|
6
|
+
* .what = validates AWS credentials are available via common sources
|
|
7
|
+
* .why = fail-fast at outlet creation rather than on first flush
|
|
8
|
+
*
|
|
9
|
+
* .note = checks env vars and shared credentials file.
|
|
10
|
+
* async credential providers (SSO, IAM roles) are validated on first flush.
|
|
11
|
+
*/
|
|
12
|
+
const assertAwsCredentialsPresent = () => {
|
|
13
|
+
// check env var credentials (most common in non-Lambda environments)
|
|
14
|
+
const hasEnvCredentials = process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY;
|
|
15
|
+
// check if profile is specified (indicates shared credentials or SSO)
|
|
16
|
+
const hasProfile = process.env.AWS_PROFILE;
|
|
17
|
+
// check if role ARN is specified (indicates assume-role config)
|
|
18
|
+
const hasRoleArn = process.env.AWS_ROLE_ARN;
|
|
19
|
+
// check if web identity is configured (EKS/IRSA)
|
|
20
|
+
const hasWebIdentity = process.env.AWS_WEB_IDENTITY_TOKEN_FILE && process.env.AWS_ROLE_ARN;
|
|
21
|
+
// check if container credentials are configured (ECS/Fargate)
|
|
22
|
+
const hasContainerCredentials = process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||
|
|
23
|
+
process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI;
|
|
24
|
+
// check if in EC2/Lambda (metadata service provides credentials)
|
|
25
|
+
const hasMetadataService = process.env.AWS_EXECUTION_ENV;
|
|
26
|
+
// if none of the common credential sources are present, fail fast
|
|
27
|
+
if (!hasEnvCredentials &&
|
|
28
|
+
!hasProfile &&
|
|
29
|
+
!hasRoleArn &&
|
|
30
|
+
!hasWebIdentity &&
|
|
31
|
+
!hasContainerCredentials &&
|
|
32
|
+
!hasMetadataService) {
|
|
33
|
+
throw new error_fns_1.BadRequestError('AWS credentials not configured. genCloudwatchOutlet requires valid AWS credentials.', {
|
|
34
|
+
hint: [
|
|
35
|
+
'configure credentials via one of:',
|
|
36
|
+
' - env: AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY',
|
|
37
|
+
' - env: AWS_PROFILE (for shared credentials or SSO)',
|
|
38
|
+
' - env: AWS_WEB_IDENTITY_TOKEN_FILE + AWS_ROLE_ARN (for EKS/IRSA)',
|
|
39
|
+
' - container: execute in ECS/Fargate with task role',
|
|
40
|
+
' - metadata: execute in EC2/Lambda with instance/execution role',
|
|
41
|
+
].join('\n'),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.assertAwsCredentialsPresent = assertAwsCredentialsPresent;
|
|
46
|
+
//# sourceMappingURL=assertAwsCredentialsPresent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertAwsCredentialsPresent.js","sourceRoot":"","sources":["../../../../src/domain.operations/outlets/cloudwatch/assertAwsCredentialsPresent.ts"],"names":[],"mappings":";;;AAAA,mDAAsD;AAEtD;;;;;;GAMG;AACI,MAAM,2BAA2B,GAAG,GAAS,EAAE;IACpD,qEAAqE;IACrE,MAAM,iBAAiB,GACrB,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAErE,sEAAsE;IACtE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IAE3C,gEAAgE;IAChE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAE5C,iDAAiD;IACjD,MAAM,cAAc,GAClB,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAEtE,8DAA8D;IAC9D,MAAM,uBAAuB,GAC3B,OAAO,CAAC,GAAG,CAAC,sCAAsC;QAClD,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC;IAEjD,iEAAiE;IACjE,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAEzD,kEAAkE;IAClE,IACE,CAAC,iBAAiB;QAClB,CAAC,UAAU;QACX,CAAC,UAAU;QACX,CAAC,cAAc;QACf,CAAC,uBAAuB;QACxB,CAAC,kBAAkB,EACnB,CAAC;QACD,MAAM,IAAI,2BAAe,CACvB,qFAAqF,EACrF;YACE,IAAI,EAAE;gBACJ,mCAAmC;gBACnC,oDAAoD;gBACpD,sDAAsD;gBACtD,oEAAoE;gBACpE,sDAAsD;gBACtD,kEAAkE;aACnE,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AA9CW,QAAA,2BAA2B,+BA8CtC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = computes the serialized size of a log event
|
|
3
|
+
* .why = enables amortized O(1) buffer size checks via incremental sum
|
|
4
|
+
*
|
|
5
|
+
* .note = this function is O(n) where n = serialized size.
|
|
6
|
+
* call once per send() and track sum to avoid full buffer re-serialize.
|
|
7
|
+
*/
|
|
8
|
+
export declare const computeLogEventSize: (event: object) => number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeLogEventSize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = computes the serialized size of a log event
|
|
6
|
+
* .why = enables amortized O(1) buffer size checks via incremental sum
|
|
7
|
+
*
|
|
8
|
+
* .note = this function is O(n) where n = serialized size.
|
|
9
|
+
* call once per send() and track sum to avoid full buffer re-serialize.
|
|
10
|
+
*/
|
|
11
|
+
const computeLogEventSize = (event) => {
|
|
12
|
+
return JSON.stringify(event).length + 1; // +1 for array comma separator
|
|
13
|
+
};
|
|
14
|
+
exports.computeLogEventSize = computeLogEventSize;
|
|
15
|
+
//# sourceMappingURL=computeLogEventSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeLogEventSize.js","sourceRoot":"","sources":["../../../../src/domain.operations/outlets/cloudwatch/computeLogEventSize.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE;IAC3D,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,+BAA+B;AAC1E,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LogEvent } from '../../../domain.objects/LogOutlet';
|
|
2
|
+
/**
|
|
3
|
+
* .what = extracts all events from buffer and clears it
|
|
4
|
+
* .why = extracts decode-friction from orchestrator (splice atomically removes and returns)
|
|
5
|
+
*/
|
|
6
|
+
export declare const drainBuffer: (buffer: LogEvent[]) => LogEvent[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.drainBuffer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = extracts all events from buffer and clears it
|
|
6
|
+
* .why = extracts decode-friction from orchestrator (splice atomically removes and returns)
|
|
7
|
+
*/
|
|
8
|
+
const drainBuffer = (buffer) => {
|
|
9
|
+
return buffer.splice(0, buffer.length);
|
|
10
|
+
};
|
|
11
|
+
exports.drainBuffer = drainBuffer;
|
|
12
|
+
//# sourceMappingURL=drainBuffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drainBuffer.js","sourceRoot":"","sources":["../../../../src/domain.operations/outlets/cloudwatch/drainBuffer.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACI,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAc,EAAE;IAC5D,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LogOutlet } from '../../../domain.objects/LogOutlet';
|
|
2
|
+
/**
|
|
3
|
+
* .what = generates a CloudWatch outlet for log events
|
|
4
|
+
* .why = enables log events to flow to CloudWatch in environments without automatic collection
|
|
5
|
+
*
|
|
6
|
+
* .note = explicit opt-in: add this outlet only when automatic log collection is absent.
|
|
7
|
+
* AWS Lambda and CloudWatch Agent environments auto-collect console.log output.
|
|
8
|
+
* in those environments, omit this outlet to avoid duplicate logs.
|
|
9
|
+
*
|
|
10
|
+
* @param region - AWS region (required: from option or AWS_REGION/AWS_DEFAULT_REGION env)
|
|
11
|
+
* @param logGroup - CloudWatch log group name (default: /aws/lambda/{service}-{env})
|
|
12
|
+
* @param logStream - CloudWatch log stream name (default: Lambda-style YYYY/MM/DD/[$LATEST]uuid)
|
|
13
|
+
* @param skipLogGroupCreation - skip log group findsert (default: false)
|
|
14
|
+
* @param flushInterval - auto-flush interval in ms (default: 5000)
|
|
15
|
+
* @param maxBufferSize - buffer size threshold in bytes for force-flush (default: 256000)
|
|
16
|
+
*/
|
|
17
|
+
export declare const genCloudwatchOutlet: ({ region: regionOverride, logGroup, logStream, skipLogGroupCreation, flushInterval, maxBufferSize, }?: {
|
|
18
|
+
region?: string;
|
|
19
|
+
logGroup?: string;
|
|
20
|
+
logStream?: string;
|
|
21
|
+
skipLogGroupCreation?: boolean;
|
|
22
|
+
flushInterval?: number;
|
|
23
|
+
maxBufferSize?: number;
|
|
24
|
+
}) => LogOutlet;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genCloudwatchOutlet = void 0;
|
|
4
|
+
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
5
|
+
const asCloudWatchBatches_1 = require("./asCloudWatchBatches");
|
|
6
|
+
const asCloudWatchLogEvents_1 = require("./asCloudWatchLogEvents");
|
|
7
|
+
const asDefaultLogStreamName_1 = require("./asDefaultLogStreamName");
|
|
8
|
+
const asLambdaStyleLogGroupName_1 = require("./asLambdaStyleLogGroupName");
|
|
9
|
+
const assertAwsCredentialsPresent_1 = require("./assertAwsCredentialsPresent");
|
|
10
|
+
const computeLogEventSize_1 = require("./computeLogEventSize");
|
|
11
|
+
const drainBuffer_1 = require("./drainBuffer");
|
|
12
|
+
/**
|
|
13
|
+
* .what = generates a CloudWatch outlet for log events
|
|
14
|
+
* .why = enables log events to flow to CloudWatch in environments without automatic collection
|
|
15
|
+
*
|
|
16
|
+
* .note = explicit opt-in: add this outlet only when automatic log collection is absent.
|
|
17
|
+
* AWS Lambda and CloudWatch Agent environments auto-collect console.log output.
|
|
18
|
+
* in those environments, omit this outlet to avoid duplicate logs.
|
|
19
|
+
*
|
|
20
|
+
* @param region - AWS region (required: from option or AWS_REGION/AWS_DEFAULT_REGION env)
|
|
21
|
+
* @param logGroup - CloudWatch log group name (default: /aws/lambda/{service}-{env})
|
|
22
|
+
* @param logStream - CloudWatch log stream name (default: Lambda-style YYYY/MM/DD/[$LATEST]uuid)
|
|
23
|
+
* @param skipLogGroupCreation - skip log group findsert (default: false)
|
|
24
|
+
* @param flushInterval - auto-flush interval in ms (default: 5000)
|
|
25
|
+
* @param maxBufferSize - buffer size threshold in bytes for force-flush (default: 256000)
|
|
26
|
+
*/
|
|
27
|
+
const genCloudwatchOutlet = ({ region: regionOverride, logGroup, logStream, skipLogGroupCreation, flushInterval, maxBufferSize, } = {}) => {
|
|
28
|
+
// validate AWS credentials are present (fail-fast)
|
|
29
|
+
(0, assertAwsCredentialsPresent_1.assertAwsCredentialsPresent)();
|
|
30
|
+
// derive region (explicit > env > fail-fast)
|
|
31
|
+
const region = regionOverride ?? process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION;
|
|
32
|
+
if (!region) {
|
|
33
|
+
throw new Error('CloudWatch outlet requires AWS region. Set AWS_REGION env var or pass region option.');
|
|
34
|
+
}
|
|
35
|
+
// derive defaults
|
|
36
|
+
const logGroupName = logGroup ?? (0, asLambdaStyleLogGroupName_1.asLambdaStyleLogGroupName)();
|
|
37
|
+
const logStreamName = logStream ?? (0, asDefaultLogStreamName_1.asDefaultLogStreamName)();
|
|
38
|
+
// create client
|
|
39
|
+
const client = new client_cloudwatch_logs_1.CloudWatchLogsClient({ region });
|
|
40
|
+
// buffer for events
|
|
41
|
+
const buffer = [];
|
|
42
|
+
let bufferSize = 0; // track size incrementally for O(1) checks
|
|
43
|
+
let initialized = false;
|
|
44
|
+
let flushPromise = null;
|
|
45
|
+
// setup auto-flush with explicit crash on error
|
|
46
|
+
const intervalMs = flushInterval ?? 5000; // 5s default for faster emission
|
|
47
|
+
const bufferLimit = maxBufferSize ?? 256000; // 256KB default for frequent flushes
|
|
48
|
+
const flushTimer = setInterval(() => {
|
|
49
|
+
flush().catch((error) => {
|
|
50
|
+
console.error('CloudWatch flush failed:', error);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
});
|
|
53
|
+
}, intervalMs);
|
|
54
|
+
flushTimer.unref(); // allow process to exit despite timer
|
|
55
|
+
// register process exit hooks (beforeExit keeps event loop alive for promises)
|
|
56
|
+
const handleExitFlush = () => {
|
|
57
|
+
flush()
|
|
58
|
+
.catch((error) => {
|
|
59
|
+
console.error('CloudWatch flush failed during exit:', error);
|
|
60
|
+
})
|
|
61
|
+
.finally(() => {
|
|
62
|
+
close();
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
process.once('beforeExit', handleExitFlush);
|
|
66
|
+
// signal handlers: flush then exit (promise chain keeps event loop alive)
|
|
67
|
+
let exitInProgress = false;
|
|
68
|
+
const handleSignalExit = (exitCode) => {
|
|
69
|
+
if (exitInProgress)
|
|
70
|
+
return;
|
|
71
|
+
exitInProgress = true;
|
|
72
|
+
flush()
|
|
73
|
+
.catch((error) => {
|
|
74
|
+
console.error('CloudWatch flush failed during signal exit:', error);
|
|
75
|
+
})
|
|
76
|
+
.finally(() => {
|
|
77
|
+
close();
|
|
78
|
+
process.exit(exitCode);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const handleSigterm = () => handleSignalExit(143); // 128 + 15 (SIGTERM)
|
|
82
|
+
const handleSigint = () => handleSignalExit(130); // 128 + 2 (SIGINT)
|
|
83
|
+
process.once('SIGTERM', handleSigterm);
|
|
84
|
+
process.once('SIGINT', handleSigint);
|
|
85
|
+
/**
|
|
86
|
+
* .what = close the outlet and release resources
|
|
87
|
+
* .why = cleans up timers and process listeners to prevent leaks in tests
|
|
88
|
+
*/
|
|
89
|
+
const close = () => {
|
|
90
|
+
clearInterval(flushTimer);
|
|
91
|
+
process.removeListener('beforeExit', handleExitFlush);
|
|
92
|
+
process.removeListener('SIGTERM', handleSigterm);
|
|
93
|
+
process.removeListener('SIGINT', handleSigint);
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* .what = findsert log group
|
|
97
|
+
* .why = idempotent creation via ResourceAlreadyExistsException
|
|
98
|
+
*/
|
|
99
|
+
const findsertLogGroup = async () => {
|
|
100
|
+
try {
|
|
101
|
+
await client.send(new client_cloudwatch_logs_1.CreateLogGroupCommand({ logGroupName }));
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (error instanceof client_cloudwatch_logs_1.ResourceAlreadyExistsException)
|
|
105
|
+
return;
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* .what = findsert log stream
|
|
111
|
+
* .why = idempotent creation via ResourceAlreadyExistsException
|
|
112
|
+
*/
|
|
113
|
+
const findsertLogStream = async () => {
|
|
114
|
+
try {
|
|
115
|
+
await client.send(new client_cloudwatch_logs_1.CreateLogStreamCommand({ logGroupName, logStreamName }));
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (error instanceof client_cloudwatch_logs_1.ResourceAlreadyExistsException)
|
|
119
|
+
return;
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* .what = initialize log group and stream
|
|
125
|
+
* .why = lazy initialization on first flush
|
|
126
|
+
*/
|
|
127
|
+
const init = async () => {
|
|
128
|
+
if (initialized)
|
|
129
|
+
return;
|
|
130
|
+
if (!skipLogGroupCreation)
|
|
131
|
+
await findsertLogGroup();
|
|
132
|
+
await findsertLogStream();
|
|
133
|
+
initialized = true;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* .what = flush buffered events to CloudWatch
|
|
137
|
+
* .why = batch send for efficiency (max 1MB, 10k events per CloudWatch limits)
|
|
138
|
+
*
|
|
139
|
+
* .invariant = single-flush-at-a-time via flushPromise
|
|
140
|
+
* - concurrent flush() calls wait on extant flushPromise
|
|
141
|
+
* - after wait, recheck buffer for events added mid-flush
|
|
142
|
+
* - recursive call handles events that arrived while awaited
|
|
143
|
+
* - prevents concurrent PutLogEvents calls (CloudWatch sequence token issues)
|
|
144
|
+
*/
|
|
145
|
+
const flush = async () => {
|
|
146
|
+
// if no events, skip
|
|
147
|
+
if (buffer.length === 0)
|
|
148
|
+
return;
|
|
149
|
+
// if flush in progress, wait then recheck for new events
|
|
150
|
+
if (flushPromise) {
|
|
151
|
+
await flushPromise;
|
|
152
|
+
if (buffer.length > 0)
|
|
153
|
+
return flush(); // recheck for events added while wait
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// start flush
|
|
157
|
+
flushPromise = (async () => {
|
|
158
|
+
// extract events from buffer (restore on failure)
|
|
159
|
+
const events = (0, drainBuffer_1.drainBuffer)(buffer);
|
|
160
|
+
const eventsSizeSnapshot = bufferSize;
|
|
161
|
+
bufferSize = 0;
|
|
162
|
+
try {
|
|
163
|
+
await init();
|
|
164
|
+
// split into CloudWatch-compliant batches (max 1MB, 10k events each)
|
|
165
|
+
const batches = (0, asCloudWatchBatches_1.asCloudWatchBatches)(events);
|
|
166
|
+
for (const batch of batches) {
|
|
167
|
+
await client.send(new client_cloudwatch_logs_1.PutLogEventsCommand({
|
|
168
|
+
logGroupName,
|
|
169
|
+
logStreamName,
|
|
170
|
+
logEvents: (0, asCloudWatchLogEvents_1.asCloudWatchLogEvents)(batch),
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
// restore events to buffer on failure (prepend to preserve order)
|
|
176
|
+
buffer.unshift(...events);
|
|
177
|
+
bufferSize += eventsSizeSnapshot;
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
flushPromise = null;
|
|
182
|
+
}
|
|
183
|
+
})();
|
|
184
|
+
await flushPromise;
|
|
185
|
+
};
|
|
186
|
+
return {
|
|
187
|
+
send: (event) => {
|
|
188
|
+
// track size incrementally (O(1) vs O(n) for full buffer stringify)
|
|
189
|
+
const eventSize = (0, computeLogEventSize_1.computeLogEventSize)(event);
|
|
190
|
+
bufferSize += eventSize;
|
|
191
|
+
buffer.push(event);
|
|
192
|
+
// force-flush if buffer exceeds size limit (explicit crash on error)
|
|
193
|
+
if (bufferSize > bufferLimit) {
|
|
194
|
+
flush().catch((error) => {
|
|
195
|
+
console.error('CloudWatch flush failed:', error);
|
|
196
|
+
process.exit(1);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
flush,
|
|
201
|
+
close,
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
exports.genCloudwatchOutlet = genCloudwatchOutlet;
|
|
205
|
+
//# sourceMappingURL=genCloudwatchOutlet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genCloudwatchOutlet.js","sourceRoot":"","sources":["../../../../src/domain.operations/outlets/cloudwatch/genCloudwatchOutlet.ts"],"names":[],"mappings":";;;AAAA,4EAMyC;AAIzC,+DAA4D;AAC5D,mEAAgE;AAChE,qEAAkE;AAClE,2EAAwE;AACxE,+EAA4E;AAC5E,+DAA4D;AAC5D,+CAA4C;AAE5C;;;;;;;;;;;;;;GAcG;AACI,MAAM,mBAAmB,GAAG,CAAC,EAClC,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,aAAa,MAQX,EAAE,EAAa,EAAE;IACnB,mDAAmD;IACnD,IAAA,yDAA2B,GAAE,CAAC;IAE9B,6CAA6C;IAC7C,MAAM,MAAM,GACV,cAAc,IAAI,OAAO,CA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AAC;QACD,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AA7MW,QAAA,mBAAmB,uBA6M9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IsoDuration } from 'iso-time';
|
|
2
|
-
import
|
|
2
|
+
import { LogLevel } from '../domain.objects/constants';
|
|
3
3
|
import type { ContextLogTrail } from '../domain.objects/LogTrail';
|
|
4
4
|
/**
|
|
5
5
|
* enables input output logging and tracing for a method
|
|
@@ -4,6 +4,8 @@ exports.withLogTrail = void 0;
|
|
|
4
4
|
const helpful_errors_1 = require("helpful-errors");
|
|
5
5
|
const iso_time_1 = require("iso-time");
|
|
6
6
|
const type_fns_1 = require("type-fns");
|
|
7
|
+
const constants_1 = require("../domain.objects/constants");
|
|
8
|
+
const generateLogMethod_1 = require("./generateLogMethod");
|
|
7
9
|
const noOp = (...input) => input;
|
|
8
10
|
const omitContext = (...input) => input[0]; // standard pattern for args = [input, context]
|
|
9
11
|
const pickErrorMessage = (input) => ({
|
|
@@ -58,17 +60,53 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
58
60
|
});
|
|
59
61
|
// begin tracking duration
|
|
60
62
|
const startTimeInMilliseconds = new Date().getTime();
|
|
63
|
+
// build the updated trail: preserve exid, append name to stack
|
|
64
|
+
const updatedTrail = {
|
|
65
|
+
exid: context.log.trail?.exid ?? null,
|
|
66
|
+
stack: [...(context.log.trail?.stack ?? []), name],
|
|
67
|
+
};
|
|
68
|
+
// extract env from context (top-level property)
|
|
69
|
+
const env = context.log.env;
|
|
70
|
+
// use level from context
|
|
71
|
+
const minimalLogLevel = context.log._.level;
|
|
72
|
+
// create base log methods with updated trail
|
|
73
|
+
const baseDebug = (0, generateLogMethod_1.generateLogMethod)({
|
|
74
|
+
level: constants_1.LogLevel.DEBUG,
|
|
75
|
+
minimalLogLevel,
|
|
76
|
+
trail: updatedTrail,
|
|
77
|
+
env,
|
|
78
|
+
});
|
|
79
|
+
const baseInfo = (0, generateLogMethod_1.generateLogMethod)({
|
|
80
|
+
level: constants_1.LogLevel.INFO,
|
|
81
|
+
minimalLogLevel,
|
|
82
|
+
trail: updatedTrail,
|
|
83
|
+
env,
|
|
84
|
+
});
|
|
85
|
+
const baseWarn = (0, generateLogMethod_1.generateLogMethod)({
|
|
86
|
+
level: constants_1.LogLevel.WARN,
|
|
87
|
+
minimalLogLevel,
|
|
88
|
+
trail: updatedTrail,
|
|
89
|
+
env,
|
|
90
|
+
});
|
|
91
|
+
const baseError = (0, generateLogMethod_1.generateLogMethod)({
|
|
92
|
+
level: constants_1.LogLevel.ERROR,
|
|
93
|
+
minimalLogLevel,
|
|
94
|
+
trail: updatedTrail,
|
|
95
|
+
env,
|
|
96
|
+
});
|
|
61
97
|
// define the context.log method that will be given to the logic
|
|
62
98
|
const logMethodsWithContext = {
|
|
63
|
-
// add the trail
|
|
64
|
-
trail:
|
|
99
|
+
// add the trail, env, and config
|
|
100
|
+
trail: updatedTrail,
|
|
101
|
+
env,
|
|
102
|
+
_: Object.freeze({ level: minimalLogLevel }),
|
|
65
103
|
// track the orig logger
|
|
66
104
|
_orig: context.log?._orig ?? context.log,
|
|
67
|
-
// add the scoped methods
|
|
68
|
-
debug: (message, metadata) =>
|
|
69
|
-
info: (message, metadata) =>
|
|
70
|
-
warn: (message, metadata) =>
|
|
71
|
-
error: (message, metadata) =>
|
|
105
|
+
// add the scoped methods with message prefix
|
|
106
|
+
debug: (message, metadata) => baseDebug(`${name}.progress: ${message}`, metadata),
|
|
107
|
+
info: (message, metadata) => baseInfo(`${name}.progress: ${message}`, metadata),
|
|
108
|
+
warn: (message, metadata) => baseWarn(`${name}.progress: ${message}`, metadata),
|
|
109
|
+
error: (message, metadata) => baseError(`${name}.progress: ${message}`, metadata),
|
|
72
110
|
};
|
|
73
111
|
// define what to do when we have an error
|
|
74
112
|
const logError = (error) => {
|
|
@@ -97,22 +135,6 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
97
135
|
logError(error);
|
|
98
136
|
throw error;
|
|
99
137
|
}
|
|
100
|
-
// if the result was a promise, log when that method crosses the reporting threshold, to identify which procedures are slow
|
|
101
|
-
if ((0, type_fns_1.isAPromise)(result)) {
|
|
102
|
-
// define how to log the breach, on breach
|
|
103
|
-
const onDurationBreach = () => context.log[logLevelOutput](`${name}.duration.breach`, {
|
|
104
|
-
input: logInputMethod(input, context),
|
|
105
|
-
already: { duration: `${durationReportingThresholdInSeconds} sec` },
|
|
106
|
-
});
|
|
107
|
-
// define a timeout which will trigger on duration threshold
|
|
108
|
-
const onBreachTrigger = setTimeout(onDurationBreach, durationReportingThresholdInSeconds * 1000);
|
|
109
|
-
// remove the timeout when the operation completes, to prevent logging if completes before duration
|
|
110
|
-
void result
|
|
111
|
-
.finally(() => clearTimeout(onBreachTrigger))
|
|
112
|
-
.catch(() => {
|
|
113
|
-
// do nothing when there's an error; just catch it, to ensure it doesn't get propagated further as an uncaught exception
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
138
|
// define what to do when we have output
|
|
117
139
|
const logOutput = (output) => {
|
|
118
140
|
const endTimeInMilliseconds = new Date().getTime();
|
|
@@ -126,9 +148,18 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
126
148
|
: {}),
|
|
127
149
|
});
|
|
128
150
|
};
|
|
129
|
-
// if result
|
|
130
|
-
if ((0, type_fns_1.isAPromise)(result))
|
|
151
|
+
// if the result was a promise, log when that method crosses the threshold, to identify which procedures are slow
|
|
152
|
+
if ((0, type_fns_1.isAPromise)(result)) {
|
|
153
|
+
// define how to log the breach, on breach
|
|
154
|
+
const onDurationBreach = () => context.log[logLevelOutput](`${name}.duration.breach`, {
|
|
155
|
+
input: logInputMethod(input, context),
|
|
156
|
+
already: { duration: `${durationReportingThresholdInSeconds} sec` },
|
|
157
|
+
});
|
|
158
|
+
// define a timeout which will trigger on duration threshold
|
|
159
|
+
const onBreachTrigger = setTimeout(onDurationBreach, durationReportingThresholdInSeconds * 1000);
|
|
160
|
+
// clear timeout when promise settles, then log output or error
|
|
131
161
|
return result
|
|
162
|
+
.finally(() => clearTimeout(onBreachTrigger))
|
|
132
163
|
.then((output) => {
|
|
133
164
|
logOutput(output);
|
|
134
165
|
return output;
|
|
@@ -137,7 +168,8 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
137
168
|
logError(error);
|
|
138
169
|
throw error;
|
|
139
170
|
});
|
|
140
|
-
|
|
171
|
+
}
|
|
172
|
+
// otherwise, not a promise, so done now — log and return the result
|
|
141
173
|
logOutput(result);
|
|
142
174
|
return result;
|
|
143
175
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLogTrail.js","sourceRoot":"","sources":["../../src/domain.operations/withLogTrail.ts"],"names":[],"mappings":";;;AAKA,mDAAyD;AACzD,uCAA4D;AAC5D,uCAAuD;
|
|
1
|
+
{"version":3,"file":"withLogTrail.js","sourceRoot":"","sources":["../../src/domain.operations/withLogTrail.ts"],"names":[],"mappings":";;;AAKA,mDAAyD;AACzD,uCAA4D;AAC5D,uCAAuD;AAEvD,6DAAyD;AAGzD,2DAAwE;AAGxE,MAAM,IAAI,GAAG,CAAC,GAAG,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC;AACtC,MAAM,WAAW,GAAG,CAAC,GAAG,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,+CAA+C;AAChG,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IAC1C,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;CAClC,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,+CAA+C;AAEvH,MAAM,iCAAiC,GAAG,OAAO,CAAC,GAAG;KAClD,6BAA6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C5D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AAhQW,QAAA,YAAY,gBAgQvB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { LogLevel } from './domain.objects/constants';
|
|
2
|
+
export type { LogEvent, LogOutlet } from './domain.objects/LogOutlet';
|
|
2
3
|
export type { ContextLogTrail, HasContextLogTrail, LogTrail, } from './domain.objects/LogTrail';
|
|
4
|
+
export { genContextLogTrail } from './domain.operations/genContextLogTrail';
|
|
3
5
|
export type { LogMethod } from './domain.operations/generateLogMethod';
|
|
4
|
-
export type { LogMethods } from './domain.operations/
|
|
5
|
-
export {
|
|
6
|
+
export type { LogMethods } from './domain.operations/genLogMethods';
|
|
7
|
+
export { genLogMethods } from './domain.operations/genLogMethods';
|
|
8
|
+
export { asDefaultLogStreamName } from './domain.operations/outlets/cloudwatch/asDefaultLogStreamName';
|
|
9
|
+
export { asLambdaStyleLogGroupName } from './domain.operations/outlets/cloudwatch/asLambdaStyleLogGroupName';
|
|
10
|
+
export { genCloudwatchOutlet } from './domain.operations/outlets/cloudwatch/genCloudwatchOutlet';
|
|
6
11
|
export { withLogTrail } from './domain.operations/withLogTrail';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withLogTrail = exports.
|
|
3
|
+
exports.withLogTrail = exports.genCloudwatchOutlet = exports.asLambdaStyleLogGroupName = exports.asDefaultLogStreamName = exports.genLogMethods = exports.genContextLogTrail = exports.LogLevel = void 0;
|
|
4
4
|
var constants_1 = require("./domain.objects/constants");
|
|
5
5
|
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return constants_1.LogLevel; } });
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "
|
|
6
|
+
var genContextLogTrail_1 = require("./domain.operations/genContextLogTrail");
|
|
7
|
+
Object.defineProperty(exports, "genContextLogTrail", { enumerable: true, get: function () { return genContextLogTrail_1.genContextLogTrail; } });
|
|
8
|
+
var genLogMethods_1 = require("./domain.operations/genLogMethods");
|
|
9
|
+
Object.defineProperty(exports, "genLogMethods", { enumerable: true, get: function () { return genLogMethods_1.genLogMethods; } });
|
|
10
|
+
var asDefaultLogStreamName_1 = require("./domain.operations/outlets/cloudwatch/asDefaultLogStreamName");
|
|
11
|
+
Object.defineProperty(exports, "asDefaultLogStreamName", { enumerable: true, get: function () { return asDefaultLogStreamName_1.asDefaultLogStreamName; } });
|
|
12
|
+
var asLambdaStyleLogGroupName_1 = require("./domain.operations/outlets/cloudwatch/asLambdaStyleLogGroupName");
|
|
13
|
+
Object.defineProperty(exports, "asLambdaStyleLogGroupName", { enumerable: true, get: function () { return asLambdaStyleLogGroupName_1.asLambdaStyleLogGroupName; } });
|
|
14
|
+
var genCloudwatchOutlet_1 = require("./domain.operations/outlets/cloudwatch/genCloudwatchOutlet");
|
|
15
|
+
Object.defineProperty(exports, "genCloudwatchOutlet", { enumerable: true, get: function () { return genCloudwatchOutlet_1.genCloudwatchOutlet; } });
|
|
8
16
|
var withLogTrail_1 = require("./domain.operations/withLogTrail");
|
|
9
17
|
Object.defineProperty(exports, "withLogTrail", { enumerable: true, get: function () { return withLogTrail_1.withLogTrail; } });
|
|
10
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAAsD;AAA7C,qGAAA,QAAQ,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAAsD;AAA7C,qGAAA,QAAQ,OAAA;AAOjB,6EAA4E;AAAnE,wHAAA,kBAAkB,OAAA;AAG3B,mEAAkE;AAAzD,8GAAA,aAAa,OAAA;AACtB,wGAAuG;AAA9F,gIAAA,sBAAsB,OAAA;AAC/B,8GAA6G;AAApG,sIAAA,yBAAyB,OAAA;AAClC,kGAAiG;AAAxF,0HAAA,mBAAmB,OAAA;AAC5B,iEAAgE;AAAvD,4GAAA,YAAY,OAAA"}
|