如何在我的php文件中使用详细的标志和摘要获取此输出?

So I have a problem where I need to get this output with verbose flag:

20181022 10:00:02 - org_added/id:1234

20181022 10:00:02 - org_updated/id:1235

20181022 10:00:02 - user_added/id:1235

20181022 10:00:02 - org_updated/id:1235

And this output with a summary:

added orgs: 120

updated orgs: 2220

added users:2

updated users: 3300

And here is my code:

foreach ($organizations as $organization) {
            try {
                if ($zenOrgs = $this->client->organizations()->search($organization['external_id'])) {
                    $this->client->organizations()->update($zenOrgs->organizations[0]->id, $organization);
                }
            } catch (\Exception $exception) {
                try {
                    $this->client->organizations()->create($organization);
                } catch (\Exception $exception) {
                    \Cli::error($exception->getMessage());
                }
            }
        }
        foreach ($users as $user) {
            try {
                if ($zenUsers = $this->client->users()->search(['external_id' => $user['external_id']])) {
                    $this->client->users()->update($zenUsers->users[0]->id, $user);
                }
            } catch (\Exception $exception) {
                var_dump($exception->getMessage());die;
                try {
                    $this->client->users()->create($user);
                } catch (\Exception $exception) {
                    \Cli::error($exception->getMessage());
                }
            }
        } 

But I just can't figure out how to implement these two things so that I can get that output. Could anybody help me with this?

Thanks a lot!