Expose hte ephemeral logging flag to the Nodejs sdk.
@@ -32,10 +32,10 @@ export function hasErrors(): boolean {
/**
* debug logs a debug-level message that is generally hidden from end-users.
*/
-export async function debug(msg: string, resource?: resourceTypes.Resource, streamId?: number) {
+export async function debug(msg: string, resource?: resourceTypes.Resource, streamId?: number, ephemeral?: boolean) {
const engine: Object | undefined = getEngine();
if (engine) {
- log(engine, engproto.LogSeverity.DEBUG, msg, resource, streamId);
+ log(engine, engproto.LogSeverity.DEBUG, msg, resource, streamId, ephemeral);
}
else {
// ignore debug messages when no engine is available.
@@ -45,10 +45,10 @@ export async function debug(msg: string, resource?: resourceTypes.Resource, stre
/**
* info logs an informational message that is generally printed to stdout during resource operations.
*/
-export function info(msg: string, resource?: resourceTypes.Resource, streamId?: number) {
+export function info(msg: string, resource?: resourceTypes.Resource, streamId?: number, ephemeral?: boolean) {
const engine: Object | undefined = getEngine();
if (engine) {
- return log(engine, engproto.LogSeverity.INFO, msg, resource, streamId);
+ return log(engine, engproto.LogSeverity.INFO, msg, resource, streamId, ephemeral);
}
else {
console.log(`info: [runtime] ${msg}`);
@@ -59,10 +59,10 @@ export function info(msg: string, resource?: resourceTypes.Resource, streamId?:
/**
* warn logs a warning to indicate that something went wrong, but not catastrophically so.
*/
-export function warn(msg: string, resource?: resourceTypes.Resource, streamId?: number) {
+export function warn(msg: string, resource?: resourceTypes.Resource, streamId?: number, ephemeral?: boolean) {
const engine: Object | undefined = getEngine();
if (engine) {
- return log(engine, engproto.LogSeverity.WARNING, msg, resource, streamId);
+ return log(engine, engproto.LogSeverity.WARNING, msg, resource, streamId, ephemeral);
}
else {
console.warn(`warning: [runtime] ${msg}`);
@@ -73,12 +73,12 @@ export function warn(msg: string, resource?: resourceTypes.Resource, streamId?:
/**
* error logs a fatal error to indicate that the tool should stop processing resource operations immediately.
*/
-export function error(msg: string, resource?: resourceTypes.Resource, streamId?: number) {
+export function error(msg: string, resource?: resourceTypes.Resource, streamId?: number, ephemeral?: boolean) {
errcnt++; // remember the error so we can suppress leaks.
const engine: Object | undefined = getEngine();
if (engine) {
- return log(engine, engproto.LogSeverity.ERROR, msg, resource, streamId);
+ return log(engine, engproto.LogSeverity.ERROR, msg, resource, streamId, ephemeral);
}
else {
console.error(`error: [runtime] ${msg}`);
@@ -89,7 +89,8 @@ export function error(msg: string, resource?: resourceTypes.Resource, streamId?:
function log(
engine: any, sev: any, msg: string,
resource: resourceTypes.Resource | undefined,
- streamId: number | undefined): Promise<void> {
+ streamId: number | undefined,
+ ephemeral: boolean | undefined): Promise<void> {
// Ensure we log everything in serial order.
const keepAlive: () => void = rpcKeepAlive();
@@ -107,6 +108,7 @@ function log(
req.setMessage(msg);
req.setUrn(urn);
req.setStreamid(streamId === undefined ? 0 : streamId);
+ req.setEphemeral(ephemeral === true);
engine.log(req, () => {
resolve(); // let the next log through
keepAlive(); // permit RPC channel tear-downs
@@ -120,4 +122,3 @@ function log(
return lastLog;
}
-
