From 0167f357b7233ec23d70985911254681b1c2e6d7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 14 Sep 2018 09:18:54 -0700 Subject: [PATCH] Provide a convenient way to log arbitrary text in Drydock without needing structured log classes Summary: Depends on D19673. Ref T13197. See PHI873. Test Plan: Added some code like this: ``` $operation->logText('Nice convenient text logging.'); ``` ...then got: {F5887712} Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13197 Differential Revision: https://secure.phabricator.com/D19674 --- src/__phutil_library_map__.php | 2 ++ .../drydock/logtype/DrydockTextLogType.php | 27 +++++++++++++++++++ .../storage/DrydockRepositoryOperation.php | 8 ++++++ 3 files changed, 37 insertions(+) create mode 100644 src/applications/drydock/logtype/DrydockTextLogType.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ed10d0f9ef..8bcf3d6120 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1206,6 +1206,7 @@ phutil_register_library_map(array( 'DrydockSlotLockException' => 'applications/drydock/exception/DrydockSlotLockException.php', 'DrydockSlotLockFailureLogType' => 'applications/drydock/logtype/DrydockSlotLockFailureLogType.php', 'DrydockTestRepositoryOperation' => 'applications/drydock/operation/DrydockTestRepositoryOperation.php', + 'DrydockTextLogType' => 'applications/drydock/logtype/DrydockTextLogType.php', 'DrydockWebrootInterface' => 'applications/drydock/interface/webroot/DrydockWebrootInterface.php', 'DrydockWorker' => 'applications/drydock/worker/DrydockWorker.php', 'DrydockWorkingCopyBlueprintImplementation' => 'applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php', @@ -6620,6 +6621,7 @@ phutil_register_library_map(array( 'DrydockSlotLockException' => 'Exception', 'DrydockSlotLockFailureLogType' => 'DrydockLogType', 'DrydockTestRepositoryOperation' => 'DrydockRepositoryOperationType', + 'DrydockTextLogType' => 'DrydockLogType', 'DrydockWebrootInterface' => 'DrydockInterface', 'DrydockWorker' => 'PhabricatorWorker', 'DrydockWorkingCopyBlueprintImplementation' => 'DrydockBlueprintImplementation', diff --git a/src/applications/drydock/logtype/DrydockTextLogType.php b/src/applications/drydock/logtype/DrydockTextLogType.php new file mode 100644 index 0000000000..8d6fe9264b --- /dev/null +++ b/src/applications/drydock/logtype/DrydockTextLogType.php @@ -0,0 +1,27 @@ +getProperty('exec.workingcopy.error'); } + public function logText($text) { + return $this->logEvent( + DrydockTextLogType::LOGCONST, + array( + 'text' => $text, + )); + } + public function logEvent($type, array $data = array()) { $log = id(new DrydockLog()) ->setEpoch(PhabricatorTime::getNow())