-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,089 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#v 0.1.1 | ||
#v 0.2.0 | ||
language: php | ||
|
||
php: | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* ___ _ | ||
* | _ \ __ _ _ _ ___ ___ | | ___ __ _ | ||
* | _// _` || '_|(_-</ -_)| |/ _ \/ _` | | ||
* |_| \__,_||_| /__/\___||_|\___/\__, | | ||
* |___/ | ||
* | ||
* (c) Kristuff <contact@kristuff.fr> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @version 0.2.0 | ||
* @copyright 2017-2020 Kristuff | ||
*/ | ||
|
||
namespace Kristuff\Parselog; | ||
|
||
use Kristuff\Parselog\Core\LogEntryFactoryInterface; | ||
use Kristuff\Parselog\Software\SoftwareLogParser; | ||
|
||
/** | ||
* | ||
*/ | ||
class LogParserFactory | ||
{ | ||
const TYPE_APACHE_ACCESS = 'apache_access'; | ||
const TYPE_APACHE_ERROR = 'apache_error'; | ||
const TYPE_SYSLOG = 'syslog'; | ||
const TYPE_FAIL2BAN = 'fail2ban'; | ||
|
||
/** | ||
* Gets a new LogParser instance based on given logType | ||
* | ||
* @access public | ||
* @static | ||
* @param string $logType The internal log type | ||
* @param string $format The log format. Default is null | ||
* @param LogEntryFactoryInterface $factory The custom log entry factory. Default is null (use default factory) | ||
* | ||
* @return \Kristuff\Parselog\LogParser|null | ||
*/ | ||
public static function getParser(string $logType, string $format = null, LogEntryFactoryInterface $factory = null): ?SoftwareLogParser | ||
{ | ||
switch ($logType){ | ||
|
||
case self::TYPE_APACHE_ACCESS: | ||
return new \Kristuff\Parselog\Software\ApacheAccessLogParser($format, $factory); | ||
|
||
case self::TYPE_APACHE_ERROR: | ||
return new \Kristuff\Parselog\Software\ApacheErrorLogParser($format, $factory); | ||
|
||
case self::TYPE_SYSLOG: | ||
return new \Kristuff\Parselog\Software\SyslogParser($format, $factory); | ||
|
||
case self::TYPE_FAIL2BAN: | ||
return new \Kristuff\Parselog\Software\Fail2BanLogParser($format, $factory); | ||
|
||
} | ||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.