Bark contains a client library which can be imported in a Golang project. Now, logs in bark are actually structured. They have a Level, a LMID and the actual message. So we wrote a parser which tries parse the log message and if it fits the formats, it would set the level and LMID along with the Log message.
The Format and Behaviour
The general format of the Log message which the parser understands (and expects) is like this:
<LVL_CHAR>#<LMID> - <LOG_MESSAGE>
These fields are:
LVL_CHAR: is a single character indicating the log severity level. The accepted characters are basically the first character of their names:
LMID: Is the Log Message Identifier. It is separated on the left from
#and on the right from the
-. The spaces around
-are optional but recommended to be left as it is.
LOG_MESSAGE: This is the actual Log Message which the user wants to save.
It is worth noting that:
- If the
LVL_CHARis set to anything else, it will automatically be set to the default log level set by the user when creating the client.
#) is optional. When it is missing, the default log level will be used instead.
It is best to demonstrate the behavior with examples.
Here is how it behaves with various inputs:
|Input string||Level||Log Message ID||Log message|
|(blank string)||(blank string)|