Skip to content

Logging DSL - #6

Merged
thekid merged 7 commits into
masterfrom
feature/logging
May 29, 2017
Merged

Logging DSL#6
thekid merged 7 commits into
masterfrom
feature/logging

Conversation

@thekid

@thekidthekid commented May 29, 2017

Copy link
Copy Markdown
Member

Example

// Before$cat= (newLogCategory())->withAppender(newColoredConsoleAppender());
// New$cat= Logging::all()->toConsole();

Modifying category, level and layout

// Set category$cat= Logging::named('sql')->toFile('sql.log');
// Change level$cat= Logging::of(LogLevel::ERROR | LogLevel::WARN)->toConsole();
// Change layout$cat= Logging::using(newPatternLayout('...'))->toSyslog(LOG_USER);

API

publicabstractclass util.log.Logging {
// Defaultpublicstatic util.log.LogSetup all()
// Shorthandspublicstaticutil.log.LogSetup named(string $category)
publicstaticutil.log.LogSetup of(int $level)
publicstaticutil.log.LogSetup using(util.log.Layout $layout)
}
publicclass util.log.LogSetup implements lang.Value {
// Fluent interfacepublicutil.log.LogSetup named(string $category)
publicutil.log.LogSetup of(string $level)
publicutil.log.LogSetup using(util.log.Layout $layout)
// Create categoriespublicutil.log.LogCategory to(util.log.Appender... $appenders) public util.log.LogCategory toConsole(bool $colors) public util.log.LogCategory toFile(string|io.Path|io.File $file)
public util.log.LogCategory toSyslog(int $facility, string $identifier)
// Value implementation
public string toString()
public string hashCode()
public int compareTo(var $value)
}

@thekid
thekid merged commit b2b8a73 into masterMay 29, 2017
@thekid
thekid deleted the feature/logging branch May 29, 2017 21:25
@thekid

Copy link
Copy Markdown
MemberAuthor

@thekidthekid mentioned this pull request Aug 10, 2018
3 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@thekid