suborbital / e2core

Server for sandboxed third-party plugins, powered by WebAssembly
https://suborbital.dev
Apache License 2.0
721 stars 42 forks source link

Separate logs from individual wasm modules from general e2core #425

Open javorszky opened 1 year ago

javorszky commented 1 year ago

Given the following log output:

se2-e2core-1       | {"level":"info","command":"start","version":"dev","module":"server","ident":"d62b7588-d131-4bf2-b90e-7e290c46ee70","namespace":"ns1","fn":"fn1","fqmn":"fqmn://d62b7588-d131-4bf2-b90e-7e290c46ee70/ns1/fn1@79a41018469c668c582501238cd6380f0400076416f0988afcfe05cf0dc8ce9d","time":1683106112,"message":"found module with fqmn"}
se2-e2core-1       | {"level":"info","scope":{"request_id":"28664d72-ad2a-4bf4-8b23-f4d0d0da370f","ident":794397155},"message":"this is a pre message thing"}
se2-e2core-1       | {"level":"info","scope":{"request_id":"28664d72-ad2a-4bf4-8b23-f4d0d0da370f","ident":794397155},"message":"Hello from tenant1 / org1.env1 / ns1 / fn1\nthis is just a version number: version 4:  hurr"}
se2-e2core-1       | {"level":"info","scope":{"request_id":"28664d72-ad2a-4bf4-8b23-f4d0d0da370f","ident":794397155},"message":"I have spoken from the plugin"}
se2-e2core-1       | {"level":"info","command":"start","version":"dev","module":"server","ident":"d62b7588-d131-4bf2-b90e-7e290c46ee70","namespace":"ns1","fn":"fn1","fqmn":"fqmn://d62b7588-d131-4bf2-b90e-7e290c46ee70/ns1/fn1@79a41018469c668c582501238cd6380f0400076416f0988afcfe05cf0dc8ce9d","time":1683106112,"message":"finished execution of the module, sending back data"}

Can you tell which one is from e2core proper, and which one is from the following built plugin:

import { log } from "@suborbital/plugin";

export const run = (input) => {
    let message = "Hello from tenant1 / org1.env1 / ns1 / fn1\n" +
    "this is just a version number: version 4:  " + input;

    log.info("this is a pre message thing")
    log.info(message);
    log.info("I have spoken from the plugin")

    return message;
};

I mean in this instance you can, however without knowing the body of the plugin, there's no way to actually distinguish logs from "this is e2core functionality" from "this is a plugin coming from e2core".

Additionally logs for the end users are not useful because they have no way of accessing them at all.