ncrashed / dlogg Goto Github PK
View Code? Open in Web Editor NEWLogging utilities that aimed to be used in highly loaded applications
License: MIT License
Logging utilities that aimed to be used in highly loaded applications
License: MIT License
../../.dub/packages/dlogg-0.4.0/source/dlogg/strict.d(19,8): Deprecation: module std.stream is deprecated - It will be removed from Phobos in October 2016. If you still need it, go to https://github.com/DigitalMars/undeaD
Would it be possible to provide a method of formatting the time? Something like a factory method that takes in the time and returns a string instead of:
https://github.com/NCrashed/dlogg/blame/master/source/dlogg/style.d#L187-L188
Tried to reload the log file on USR1 signal:
import core.stdc.signal;
enum SIGUSR1 = 10;
signal(SIGUSR1, function void() @system nothrow @nogc {
logger.reload();
});
This code failed to compile:
source/log.d(56,16): Error: @nogc function 'log._sharedStaticCtor11.__funcliteral1' cannot call non-@nogc function 'dlogg.strict.StyledStrictLogger!(LogLevel, cast(LogLevel)0, "[%2$s]: \x1b[95mDebug:\x1b[0m %1$s", "[%2$s]: Debug: %1$s", cast(LogLevel)1, "[%2$s]: \x1b[92mInfo:\x1b[0m %1$s", "[%2$s]: Info: %1$s", cast(LogLevel)2, "[%2$s]: \x1b[93mWarning:\x1b[0m %1$s", "[%2$s]: Warning: %1$s", cast(LogLevel)3, "[%2$s]: \x1b[91mError:\x1b[0m %1$s", "[%2$s]: Error: %1$s", cast(LogLevel)4, "[%2$s]: \x1b[1m\x1b[91mFatal:\x1b[0m\x1b[0m %1$s", "[%2$s]: Fatal: %1$s", cast(LogLevel)5, "", "").StyledStrictLogger.reload'
source/log.d(56,16): Error: function `dlogg.strict.StyledStrictLogger!(LogLevel, cast(LogLevel)0, "[%2$s]: \x1b[95mDebug:\x1b[0m %1$s", "[%2$s]: Debug: %1$s", cast(LogLevel)1, "[%2$s]: \x1b[92mInfo:\x1b[0m %1$s", "[%2$s]: Info: %1$s", cast(LogLevel)2, "[%2$s]: \x1b[93mWarning:\x1b[0m %1$s", "[%2$s]: Warning: %1$s", cast(LogLevel)3, "[%2$s]: \x1b[91mError:\x1b[0m %1$s", "[%2$s]: Error: %1$s", cast(LogLevel)4, "[%2$s]: \x1b[1m\x1b[91mFatal:\x1b[0m\x1b[0m %1$s", "[%2$s]: Fatal: %1$s", cast(LogLevel)5, "", "").StyledStrictLogger.reload` is not nothrow
source/log.d(55,21): Error: nothrow function `log._sharedStaticCtor11.__funcliteral1` may throw
Indeed, it's neither nothrow nor @nogc, but it should be. To my suprise, even the function std.file.exists, which is used by reload is not @nogc, since it allocates temporary strings for paths. I could just declare the signal function myself and change the signature of the signal handler, but it would be asking for trouble. OS doesn't ask politely when a signal arrives, it just interrupts a random thread of the program to handle it. According to man 7 pthreads:
POSIX.1 distinguishes the notions of signals that are directed to the process as a whole and signals that are directed to individual threads. According to POSIX.1, a process-directed signal (sent using kill(2), for example) should be handled by a single, arbitrarily selected thread within the process.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.