Skip to content

Commit

Permalink
Revert "Changed status to logLevel - Fixes #44"
Browse files Browse the repository at this point in the history
This reverts commit 5ee5b61.
  • Loading branch information
TanmoySG authored Jun 17, 2022
1 parent 1a22931 commit a9d03c5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ ENDPOINT: localhost:8080/{publisher}/{context}/logs
METHOD : POST
PAYLOAD :
{
"logLevel" : "WARN",
"status" : "WARN",
"column1" : "Testing Logsmith",
"column2" : "RESTClient",
...
}
```
Note:

- Here, LogLevel is the the Priority of the Log and can have any value like - WARN, INFO, FAILURE, etc.
- Here, status is the LogLevel, i.e. the Priority of the Log and can have any value like - WARN, INFO, FAILURE, etc.
- A publisher can add timestamp from their own end, which overrides the system-set timestamp.
- If timestamp is not added to the log payload, system-generated timestamp is used.

Expand Down
2 changes: 1 addition & 1 deletion handlers/contexts/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { StandardizeIdentifier } from '../utilities/identifierUtility.js';

const ContextRegistryTemplate = {}

const defaultLogSchema = ["timestamp", "logLevel"]
const defaultLogSchema = ["timestamp", "status"]
const defaultMetricSchema = ["timestamp"]

const logRegistryTemplate = {
Expand Down
2 changes: 1 addition & 1 deletion handlers/contexts/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function validateNewContext(newContext, ContextRegistry) {
export function checkLogHasValidSchema(newContext) {
if (Array.isArray(newContext["kind"]["logs"])) {
if (newContext["kind"]["logs"].length > 0) {
if (newContext["kind"]["logs"].every(columnName => ["timestamp", "logLevel"].includes(columnName))) {
if (newContext["kind"]["logs"].every(columnName => ["timestamp", "status"].includes(columnName))) {
return false
} else {
return true
Expand Down
6 changes: 3 additions & 3 deletions handlers/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ const logg1 = {
"col1" : "test",
"col2": "test2",
"timestamp" : 123456,
"logLevel" : "WARN"
"status" : "WARN"
}

const logg2={
"col1" : "test",
"col2": "test2",
"logLevel" : "WARN"
"status" : "WARN"
}

const logg3={
"col" : "test",
"col2": "test2",
"logLevel" : "WARN"
"status" : "WARN"
}

registerNewLog(publisher, context,logg1, function (err) {
Expand Down
4 changes: 2 additions & 2 deletions handlers/publishers/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export function validateExistingPublisher(publisher, PublisherRegistry) {
}

export function validateLog(LogBody) {
if (["context", "logLevel", "message"] in LogBody) {
if (["context", "status", "message"] in LogBody) {
if (
length(LogBody["context"]) != 0 &&
length(LogBody["logLevel"]) != 0 &&
length(LogBody["status"]) != 0 &&
length(LogBody["message"]) != 0
) {
return true
Expand Down
4 changes: 2 additions & 2 deletions test/RESTSnippets.rest
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ POST {{host}}/{{publisher}}/{{context}}/logs HTTP/1.1
content-type: application/json

{
"logLevel" : "INFO",
"status" : "INFO",
"message" : "Testing Logsmith",
"mode" : "RESTClient"
}
Expand All @@ -50,7 +50,7 @@ content-type: application/json

{
"timestamp" : {{$timestamp}},
"logLevel" : "WARN",
"status" : "WARN",
"message" : "Testing Logsmith",
"mode" : "RESTClient"
}
Expand Down

0 comments on commit a9d03c5

Please sign in to comment.