Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added RollBar Logger Changes #25

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

pranjalg13
Copy link

@pranjalg13 pranjalg13 commented Apr 1, 2023

@pranjalg13
Copy link
Author

@christyjacob4 Please review this once

@pranjalg13
Copy link
Author

Screenshot 2023-04-01 at 3 09 06 PM

Screenshot for rollbar logs

@stnguyen90
Copy link
Contributor

stnguyen90 commented Jul 24, 2023

Successful test:

image
{
  "body": {
    "timestamp": 1690241898,
    "message": {
      "body": "Document efgh5678 not found"
    }
  },
  "uuid": "7a49f3c1bb014cfc8e32bcdcbc78ce46",
  "level": "error",
  "timestamp": 1690241898,
  "custom": [
    "sdk: Flutter",
    "sdkVersion: 0.0.1",
    "authMode: default",
    "authMethod: cookie",
    "authProvider: MagicLink",
    "type: error",
    "environment: production",
    "sdk: utopia-logger/0.1.0"
  ],
  "environment": "production",
  "framework": "unknown",
  "trace_chain": [
    {
      "category": "http",
      "message": "DELETE /api/v1/database/abcd1234/efgh5678",
      "type": "default",
      "level": "debug"
    },
    {
      "category": "auth",
      "message": "Using API key",
      "type": "default",
      "level": "debug"
    },
    {
      "category": "auth",
      "message": "Authenticated with * Using API Key",
      "type": "default",
      "level": "info"
    },
    {
      "category": "database",
      "message": "Found collection abcd1234",
      "type": "default",
      "level": "info"
    },
    {
      "category": "database",
      "message": "Permission for collection abcd1234 met",
      "type": "default",
      "level": "debug"
    },
    {
      "category": "database",
      "message": "Missing document when searching by ID!",
      "type": "default",
      "level": "error"
    }
  ],
  "metadata": {}
}

@stnguyen90
Copy link
Contributor

stnguyen90 commented Jul 24, 2023

example with proper stack trace:

image
{
  "body": {
    "trace": {
      "frames": [
        {
          "method": "include",
          "args": [
            "/workspace/logger/vendor/phpunit/phpunit/phpunit"
          ],
          "lineno": 122,
          "filename": "/workspace/logger/vendor/bin/phpunit"
        },
        {
          "method": "PHPUnit\\TextUI\\Command::main",
          "args": [],
          "lineno": 107,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/phpunit"
        },
        {
          "method": "PHPUnit\\TextUI\\Command::run",
          "args": [
            [
              "vendor/bin/phpunit",
              "--configuration",
              "phpunit.xml",
              "tests"
            ],
            true
          ],
          "lineno": 97,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/TextUI/Command.php"
        },
        {
          "method": "PHPUnit\\TextUI\\TestRunner::run",
          "args": [
            {
              "class": "PHPUnit\\Framework\\TestSuite",
              "value": [
                {
                  "class": "PHPUnit\\Framework\\TestSuite",
                  "value": [
                    {
                      "class": "LoggerTest",
                      "value": []
                    },
                    {
                      "class": "LoggerTest",
                      "value": []
                    },
                    {
                      "class": "LoggerTest",
                      "value": []
                    },
                    {
                      "class": "LoggerTest",
                      "value": []
                    }
                  ]
                }
              ]
            },
            {
              "registerMockObjectsFromTestArgumentsRecursively": false,
              "forceCoversAnnotation": false,
              "verbose": false,
              "convertDeprecationsToExceptions": false,
              "executionOrderDefects": 0,
              "failOnSkipped": false,
              "beStrictAboutResourceUsageDuringSmallTests": false,
              "stopOnFailure": false,
              "disallowTodoAnnotatedTests": false,
              "colors": "auto",
              "stopOnRisky": false,
              "listSuites": false,
              "executionOrder": 0,
              "convertNoticesToExceptions": true,
              "stopOnError": false,
              "failOnRisky": false,
              "noInteraction": false,
              "stopOnSkipped": false,
              "processIsolation": false,
              "enforceTimeLimit": false,
              "backupGlobals": false,
              "notLoadedExtensions": [],
              "strictCoverage": false,
              "reportLowUpperBound": 50,
              "reverseList": false,
              "resolveDependencies": true,
              "testdoxExcludeGroups": [],
              "randomOrderSeed": 1690242484,
              "testdoxGroups": [],
              "cacheResult": true,
              "failOnEmptyTestSuite": false,
              "columns": 80,
              "crap4jThreshold": 30,
              "cacheResultFile": "/workspace/logger",
              "listGroups": false,
              "repeat": false,
              "stopOnDefect": false,
              "listTests": false,
              "warnings": [],
              "groups": [],
              "beStrictAboutChangesToGlobalState": false,
              "timeoutForMediumTests": 10,
              "useDefaultConfiguration": true,
              "configurationObject": {
                "class": "PHPUnit\\TextUI\\XmlConfiguration\\Configuration",
                "value": []
              },
              "convertErrorsToExceptions": true,
              "reportUselessTests": true,
              "disableCodeCoverageIgnore": false,
              "configuration": "phpunit.xml",
              "stopOnWarning": false,
              "unavailableExtensions": [],
              "failOnWarning": false,
              "loadedExtensions": [],
              "stopOnIncomplete": false,
              "defaultTimeLimit": 1,
              "listTestsXml": false,
              "failOnIncomplete": false,
              "backupStaticAttributes": false,
              "bootstrap": "./vendor/autoload.php",
              "timeoutForSmallTests": 1,
              "disallowTestOutput": false,
              "testSuffixes": [
                "Test.php",
                ".phpt"
              ],
              "filter": false,
              "reportHighLowerBound": 90,
              "listeners": [],
              "excludeGroups": [],
              "extensions": [],
              "stderr": false,
              "debug": false,
              "convertWarningsToExceptions": true,
              "ignoreDeprecatedCodeUnitsFromCodeCoverage": false,
              "reverseDefectList": false,
              "timeoutForLargeTests": 60
            },
            [],
            true
          ],
          "lineno": 144,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/TextUI/Command.php"
        },
        {
          "method": "PHPUnit\\Framework\\TestSuite::run",
          "args": [
            {
              "class": "PHPUnit\\Framework\\TestResult",
              "value": []
            }
          ],
          "lineno": 651,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/TextUI/TestRunner.php"
        },
        {
          "method": "PHPUnit\\Framework\\TestSuite::run",
          "args": [
            {
              "class": "PHPUnit\\Framework\\TestResult",
              "value": []
            }
          ],
          "lineno": 684,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/Framework/TestSuite.php"
        },
        {
          "method": "PHPUnit\\Framework\\TestCase::run",
          "args": [
            {
              "class": "PHPUnit\\Framework\\TestResult",
              "value": []
            }
          ],
          "lineno": 684,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/Framework/TestSuite.php"
        },
        {
          "method": "PHPUnit\\Framework\\TestResult::run",
          "args": [
            {
              "class": "LoggerTest",
              "value": []
            }
          ],
          "lineno": 964,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/Framework/TestCase.php"
        },
        {
          "method": "PHPUnit\\Framework\\TestCase::runBare",
          "args": [],
          "lineno": 728,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/Framework/TestResult.php"
        },
        {
          "method": "PHPUnit\\Framework\\TestCase::runTest",
          "args": [],
          "lineno": 1214,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/Framework/TestCase.php"
        },
        {
          "method": "LoggerTest::testAdapters",
          "args": [],
          "lineno": 1608,
          "filename": "/workspace/logger/vendor/phpunit/phpunit/src/Framework/TestCase.php"
        },
        {
          "lineno": 201,
          "filename": "/workspace/logger/tests/LoggerTest.php"
        }
      ],
      "exception": {
        "message": "test exception",
        "class": "Exception"
      }
    }
  },
  "uuid": "1a71e944-02b4-457a-a02a-3f0d38b4f074",
  "language": "php",
  "level": "error",
  "timestamp": 1690242484,
  "code_version": "",
  "request": {
    "POST": [],
    "GET": []
  },
  "server": {
    "host": "55b92c98fe5a",
    "argv": [
      "vendor/bin/phpunit",
      "--configuration",
      "phpunit.xml",
      "tests"
    ]
  },
  "environment": "production",
  "platform": "Linux 55b92c98fe5a 6.1.27-060127-generic #202305051509 SMP PREEMPT_DYNAMIC Fri May  5 15:48:49 UTC 2023 x86_64",
  "framework": "unknown",
  "custom": [],
  "notifier": {
    "version": "3.1.2",
    "name": "rollbar-php"
  },
  "metadata": {
    "customer_timestamp": 1690242484
  }
}

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! Before we merge this, would you please remove the .DS_Store file from the PR?

@pranjalg13 pranjalg13 requested a review from stnguyen90 July 26, 2023 12:54
Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's a lint error. Would you please run the formatter?

@pranjalg13 pranjalg13 requested a review from stnguyen90 July 27, 2023 02:59
Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey 👋 awesome work on your PR! We've approved your work and it'll be merged soon!

@christyjacob4, I think this is good to merge, but we need to add the TEST_ROLLBAR_KEY secret for the tests, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants