GithubHelp home page GithubHelp logo

Comments (14)

algernon avatar algernon commented on July 1, 2024

I suppose delimiters(string(":\n")) could be one way to specify multichar delimiters, without breaking backwards compatibility, and still making sense.

from syslog-ng.

faxm0dem avatar faxm0dem commented on July 1, 2024

Looks sane to me yes

from syslog-ng.

ihrwein avatar ihrwein commented on July 1, 2024

What do you think about flags(string-delimiter)? It wouldn't introduce an other member variable in LogCSVParser and the code would be more consistent.

from syslog-ng.

juhaszviktor avatar juhaszviktor commented on July 1, 2024

👍 for string-delimiter flag

from syslog-ng.

algernon avatar algernon commented on July 1, 2024

I'm not a great fan of flags, to be honest. It means I have to keep an eye on two settings, and makes it harder to write blocks or other kinds of DSL.

from syslog-ng.

ihrwein avatar ihrwein commented on July 1, 2024

A third option won: string-delimiters(":,", "//"). You can use this and delimiters() simultaneously, the former has the precedence.

I have a little ugly, but working version here: https://github.com/ihrwein/syslog-ng/tree/f/csv-string-delimeter
According to the test cases it does it's job, but I'm working on refactoring the whole code.

from syslog-ng.

algernon avatar algernon commented on July 1, 2024

Well, that has the same problem as the string-delimiter flag: making it harder to write anything on top of it. But since I won't be using the functionality, it doesn't matter for me. Just wanted to highlight that using a new option instead of the flag doesn't change much from a DSL point of view.

from syslog-ng.

lbudai avatar lbudai commented on July 1, 2024

@algernon: thank you for your notes (Having more opinions before implementing a feature is a good thing, IMHO. )

As I see your idea, the optimal solution would be if user could set delimiters as:
delimiters(chars(",;:"), string("xx")) . But -as you already mentioned- we have to deal with backward compatibility. So backward compatibility breaks the optimal solution, in that situation, from my point of view, both solution is fine, but I would go with string-delimiters() option :-) .

@faxm0dem: which solution do yo prefer? (our opinions -as developers- not as important as yours :-) )
a)
delimiters(":,", string("//"))

b)
delimiters(":,")
string-delimiters("//")

from syslog-ng.

faxm0dem avatar faxm0dem commented on July 1, 2024

both would work for me, whatever's easiest to implement/maintain

from syslog-ng.

lbudai avatar lbudai commented on July 1, 2024

Ok, we prefer solution b) .

Thanks!

from syslog-ng.

algernon avatar algernon commented on July 1, 2024

My optimal solution would be delimiters(",;:") working as before, internally perhaps being an alternative to delimiters(chars(",;:")). And only delimiters(string(",;:")) would be new.

The grammar rules for this aren't all that bad:

| KW_DELIMITERS '(' delimit-spec ')' { YYACCEPT; }

and then:

delimit-spec
 : KW_CHARS '(' string ')' { ... }
 | KW_STRING '(' string ')' { ... }
 | string { /* same code as KW_CHARS case */ }
 ;

Voila. All syntax within delimiters(), backward compatibility still preserved.

from syslog-ng.

lbudai avatar lbudai commented on July 1, 2024

@algernon: finally, your suggestion was chosen :-)

from syslog-ng.

ihrwein avatar ihrwein commented on July 1, 2024

@faxm0dem, could you check it too?

from syslog-ng.

ihrwein avatar ihrwein commented on July 1, 2024

The PR was merged, so this issue can be closed.

from syslog-ng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.