<commit_before><?php

namespace Productsup;

/**
 * Log information that could be required during the output
 *
 */
class LogInfo
{
    /**
     * @var integer $site Site ID
     */
    public $site = null;

    /**
     * @var string $process Process ID
     */
    public $process = null;

    /**
     * @var string $facility the Facility that is being Logged from
     */
    public $facility = null;
}<commit_msg>add a function to create the logger from a string<commit_after><?php

namespace Productsup;

/**
 * Log information that could be required during the output
 *
 */
class LogInfo
{
    /**
     * @var integer $site Site ID
     */
    public $site = null;

    /**
     * @var string $process Process ID
     */
    public $process = null;

    /**
     * @var string $facility the Facility that is being Logged from
     */
    public $facility = null;

    /**
     * @param string $string a string like site:123;process:abcdef;facility:destination
     * @return static
     */
    public static function fromString($string) {
        $parts = explode(';',$string);
        $info = new static;
        foreach($parts as $part) {

            $property = explode(':',$part,2);
            if(property_exists($info,$property[0])) {
                $info->{$property[0]} = $property[1];
            }
        }
        return $info;
    }
}
{'fraction_non_alphanumeric': 0.12675018422991893, 'fraction_numerical': 0.005158437730287398, 'mean_word_length': 2.129032258064516, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5971597', 'n_tokens_mistral': 400, 'n_tokens_neox': 389, 'n_words': 123}