summaryrefslogtreecommitdiffstats
path: root/lib/public/Log
Commit message (Collapse)AuthorAgeFilesLines
* Add a helper function that makes it easier to log from anywhereChristoph Wurst2022-05-231-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | Our DI is able to inject a logger implementation to any server and app class if they want one. However, sometimes DI isn't applicable or hard to add. In those cases we typically fell back to the *service locator* pattern where we acquired a logger from the server via a global variable. There were some issues with that * `\OC` is a private class, apps are not supposed to use it * `\OC::$server` is a global variable, a well known anti-pattern * `\OC::$server->get(...)` uses the service locator anti-pattern * `\OC::$server->get(...)` may throw * `\OC::$server->get(LoggerInterface::class)` is not scoped to an app With this patch I'm proposing a new helper function ``\OCP\Log\logger`` that can be used to acquire a logger more easily. This function is meant to be public API and therefore apps may use it and there is an optional parameter to specifiy the app ID. The function hides all the ugly details about the global variable and the potentially thrown exceptions from the user. Therefore it's guaranteed that you always get a logger instance. In the worst case you get a noop, though those occasions should be rare. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Allow to get custom loggers for syslog, errorlog and systemdlog tooJoas Schilling2022-01-191-2/+4
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Update php licensesJohn Molakvoæ (skjnldsv)2021-06-046-12/+8
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* typodartcafe2021-05-191-1/+1
| | | | Signed-off-by: dartcafe <github@dartcafe.de>
* fix #25813dartcafe2021-05-191-1/+1
| | | | Signed-off-by: dartcafe <github@dartcafe.de>
* Fix versionJoas Schilling2021-04-121-1/+1
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Move to another namespace and class nameJoas Schilling2021-04-091-2/+2
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Allow apps to log actions into the audit_logJoas Schilling2021-04-091-0/+85
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Migrate custom loggers to PSRChristoph Wurst2021-02-111-0/+10
| | | | | | This will help phase out the deprecated ILogger interface. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update all license headers for Nextcloud 21Christoph Wurst2020-12-161-0/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Format code to a single space around binary operatorsChristoph Wurst2020-10-051-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Remove @package annotations from public namespaceJulius Härtl2020-08-265-5/+0
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-102-2/+0
| | | | | | | | | | | | | | | To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update the license headers for Nextcloud 19Christoph Wurst2020-03-311-1/+3
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* always require a message paramter for data loggingArthur Schiwon2020-01-281-3/+3
| | | | | | also ensure it plays well with current log reader Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* log Flow activityArthur Schiwon2020-01-281-0/+42
| | | | Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* Update license headersChristoph Wurst2019-12-054-4/+4
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Added a logger for systemd/journaldJohannes Ernst2018-06-291-1/+2
| | | | | | Added a unit test Signed-off-by: Johannes Ernst <jernst@indiecomputing.com>
* log to $datadir/audit.log by default and add rotationArthur Schiwon2018-04-261-0/+71
| | | | Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* add missing php doc and type hintsArthur Schiwon2018-04-261-2/+15
| | | | Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* move IFileBased to public namespace, logreader needs itArthur Schiwon2018-04-261-0/+30
| | | | Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* offer API to create own File log. admin_audit makes use of itArthur Schiwon2018-04-262-0/+85
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>