utopia-php / logger Goto Github PK
View Code? Open in Web Editor NEWLite & fast micro PHP logging library that is **easy to use**.
License: MIT License
Lite & fast micro PHP logging library that is **easy to use**.
License: MIT License
Push logs to Elastic Cloud and/or hosted ELK cluster
All actual adapter are paid. I use all day kibana / ELK stack for free (on dev, stagging, prod)
The best would be to implement the apm php agent to have a complete APM integration (ideally there should be an APM integration to all appwrite and not only this repo).
It's also possible via an http request to logstash (and others)
Currently the Rollbar adapter does not send a stack trace and so errors in Rollbar look like:
{
"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": {}
}
It would be helpful to get the stack trace in Rollbar so it looks more like:
{
"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
}
}
Having a stacktrace would make it easier to troubleshoot errors.
All Utopia libraries focus on supporting multiple adapters such as storage, database, cache or logger. We currently support only 3 providers for Logger library, but we are looking to increase this number! By preparing easy-to-follow instructions, we believe anyone can implement a new provider and get their contribution counts up ๐
Your task is to implement GlitchTip adapter into our Logger library. You can find a complete in-depth tutorial in our official tutorial for adding a new logger adapter. To find out more about GlitchTip, check out their Website.
utopia-php/logger
(this repository)feat-add-glitchtip-adapter
src/Logger/Adapter/GlitchTip.php
and implement itPROVIDERS
array in src/Logger/Logger.php
tests/LoggerTest.php
If you need any help, reach out to us on Appwrite Discord server.
Are you ready to work on this issue? ๐ค Let us know, and we will assign it to you ๐
Sentry can be self hosted, so it would be nice if we could specify the Host instead of having it hardcoded tohttps://sentry.io/api
.
This would allow users of self hosted sentry instances to also use the Utopia Logger by allowing sentryHost
to be passed into the SentryAdapter the same way projectId
and sentryKey
are.
In Appwrite we could append/prepend it to the _APP_LOGGING_CONFIG
and if it's missing default to sentry.io
It would be really nice to be able to pass the stack trace along. Check out how it's implemented in Sentry and how we call this in Appwrite.
Originally posted by @stnguyen90 in #19 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.