<commit_before>//
//  Copyright (c) SRG. All rights reserved.
//
//  License information is available from the LICENSE file.
//

import SRGLogger_Swift
import XCTest

class LoggerSwiftTestCase : XCTestCase {

    internal func testLogging() -> Void {
        SRGLogError(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Error!")
        SRGLogWarning(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Warning!")
        
        let string = "Hello, World!"
        SRGLogError(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Error with string '\(string)'")
        SRGLogError(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Error with dictionary \([ "key" : "value" ])")
    }
}<commit_msg>Add custom function example<commit_after>//
//  Copyright (c) SRG. All rights reserved.
//
//  License information is available from the LICENSE file.
//

import SRGLogger_Swift
import XCTest

func TestLogError(category : String?, message: String, file: String = #file, function: String = #function, line: UInt = #line) {
    SRGLogError(subsystem: "ch.srgssr.logger-tests", category: category, message: message, file: file, function: function, line: line);
}

class LoggerSwiftTestCase : XCTestCase {

    internal func testLogging() -> Void {
        SRGLogError(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Error!")
        SRGLogWarning(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Warning!")
        
        let string = "Hello, World!"
        SRGLogError(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Error with string '\(string)'")
        SRGLogError(subsystem: "ch.srgssr.logger-tests", category: "Test-Swift", message: "Error with dictionary \([ "key" : "value" ])")
        
        TestLogError(category: "Test-Swift", message: "Error!")
    }
}
{'fraction_non_alphanumeric': 0.14814814814814814, 'fraction_numerical': 0.0, 'mean_word_length': 3.771144278606965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4115170', 'n_tokens_mistral': 622, 'n_tokens_neox': 605, 'n_words': 155}