There are (at least) three common ways to do it—ranging from the quick-and-dirty one-liner to a slightly cleaner refactor. Pick the one that best fits how much you want to change the codebase.
1. Easiest: just change the tag in the string
If all you really need is a one-off log entry for META, nothing stops you from doing:
$this->_clsLogs->insertNewLog('[META][EXPORT] Export file saved at ' . $filepath);
Literally the only difference is the word GOOGLE → META.
Pros
• One-liner; zero refactor.
Cons
• Duplicates the hard-coded tag; can get messy if you start adding more platforms.
2. Introduce a helper/wrapper method for META exports
If you see yourself logging lots of META-related events, add a small wrapper:
class YourClass
{
protected $_clsLogs;
// …
protected function logMetaExport(string $filepath): void
{
$this->_clsLogs->insertNewLog(
'[META][EXPORT] Export file saved at ' . $filepath
);
}
}
Usage:
$this->logMetaExport($filepath);
Pros
• Keeps platform-specific tagging in one place.
• Won’t break existing GOOGLE logs.
Cons
• Still hard-codes the string; you’ll need one wrapper per platform.
3. Make the logger platform-agnostic
If you anticipate many platforms (GOOGLE, META, TIKTOK, …) refactor insertNewLog() (or wrap it) so you can pass the platform as an argument:
// Add to your logger class
public function insertPlatformLog(
string $platform,
string $action,
string $message
): void {
// e.g. [META][EXPORT] Export file saved at /path/file.csv
$entry = sprintf('[%s][%s] %s', strtoupper($platform), strtoupper($action), $message);
$this->insertNewLog($entry);
}
Then call it like this:
$this->_clsLogs->insertPlatformLog(
platform: 'meta',
action: 'export',
message: 'Export file saved at ' . $filepath
);
Pros
• One method handles every platform/action.
• Easy to unit-test & extend.
Cons
• Requires touching the logger class (slightly more work).
Pick your poison
• Quick fix & you’ll never touch this again? → Method #1.
• You only need META and GOOGLE and prefer readability? → Method #2.
• You foresee multiple platforms and more log types? → Method #3 (or any fully-fledged PSR-3 logger).
Let me know if you’d like code samples for the other options, or details on unit tests / dependency injection best practices.