electron-log
electron-log copied to clipboard
Add gRPC as remote transport
For reasons that are inherent to my project, I need to implement gRPC transport instead of using http. I would like to contribute. My idea is the following (please note that this is pseudocode):
const service = /* grpcService */;
let hostAndPort;
function grpcTransport(electronLog) {
if(hostAndPort) service.send(electronLog);
}
using the following proto
syntax = "proto3";
service RemoteLog {
rpc Error(stream Message) returns (Empty) {}
rpc Warn(stream Message) returns (Empty) {}
rpc Info(stream Message) returns (Empty) {}
rpc Verbose(stream Message) returns (Empty) {}
rpc Debug(stream Message) returns (Empty) {}
rpc Silly(stream Message) returns (Empty) {}
}
message Message {
string content = 1;
}
message Empty {}
Do you have any suggestions?
Thank you.
Thank you for the suggestion. I think it's pretty rare scenario when gRPC is used, so I it's better to keep such a module as a third-party library. I can add a link to such a transport to readme.
const log = require('electron-log');
const gRPCTransport = require('electron-log-grpc');
log.transports.grpc = gRPCTransport({ ...transportOptions });
Ok. When I'm done, I'll let you know in case you want to update the documentation
Please let me know if it's ready