Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
Implementing a MessageTemplate to String

I'm working on an angular project in which the HTML is embedded in a device.. not a traditional web browser of a computer. Anyway I need to send a logging mechanism to a host device that is acting as a server of sorts.

I got the service running and it is working. I can send messages back and forth. I need to do a structured logging and was wondering if there are existing packages already available instead of writing my own.

So something like this:

JAVASCRIPT:

export class LogEvent
{
    constructor(logLevel: any, messageTemplate: string , exception? : any , args? : any[])
    {
        this.Level = logLevel;
        this.MessageTemplate = messageTemplate;
        this.Exception = exception;
        if (args) this.Properties = [... args];
    }
    toString() : string {
        //this is what i Need.. to convert props into strings embeded into the 
        //MessageTemplate
    }
}
var someValue = 1234;
var msgT = "A message {someValue}";
var event = LogEvent(verbose, msgT, null, someValue);
var str = event.toString()
// expected str to be 'A message 1234'

the npm pacakage @messageformat/parser will parse the messageTemplate but i havent seen a method to actually create the message with the values inserted into the message template.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda