Parses a structured log entry and reformats it for display using multiple variables.
ID: 1199
using uCalcSoftware;
var uc = new uCalc();
var t = new uCalc.Transformer();
// Note the use of {@String} to capture the quoted text
t.FromTo("'['{level}']' Code: {code}, Msg: {@String:message}",
"[{level}] - {message} (Code {code})");
var log = "[ERROR] Code: 404, Msg: 'Not Found'";
Console.WriteLine(t.Transform(log));
[ERROR] - Not Found (Code 404) using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Note the use of {@String} to capture the quoted text t.FromTo("'['{level}']' Code: {code}, Msg: {@String:message}", "[{level}] - {message} (Code {code})"); var log = "[ERROR] Code: 404, Msg: 'Not Found'"; Console.WriteLine(t.Transform(log));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Transformer t;
// Note the use of {@String} to capture the quoted text
t.FromTo("'['{level}']' Code: {code}, Msg: {@String:message}",
"[{level}] - {message} (Code {code})");
auto log = "[ERROR] Code: 404, Msg: 'Not Found'";
cout << t.Transform(log) << endl;
}
[ERROR] - Not Found (Code 404) #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Transformer t; // Note the use of {@String} to capture the quoted text t.FromTo("'['{level}']' Code: {code}, Msg: {@String:message}", "[{level}] - {message} (Code {code})"); auto log = "[ERROR] Code: 404, Msg: 'Not Found'"; cout << t.Transform(log) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t As New uCalc.Transformer()
'// Note the use of {@String} to capture the quoted text
t.FromTo("'['{level}']' Code: {code}, Msg: {@String:message}",
"[{level}] - {message} (Code {code})")
Dim log = "[ERROR] Code: 404, Msg: 'Not Found'"
Console.WriteLine(t.Transform(log))
End Sub
End Module
[ERROR] - Not Found (Code 404) Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t As New uCalc.Transformer() '// Note the use of {@String} to capture the quoted text t.FromTo("'['{level}']' Code: {code}, Msg: {@String:message}", "[{level}] - {message} (Code {code})") Dim log = "[ERROR] Code: 404, Msg: 'Not Found'" Console.WriteLine(t.Transform(log)) End Sub End Module